import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.function.BiFunction;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int value1 = scanner.nextInt();
int value2 = scanner.nextInt();
BiFunction<Integer, Integer, List<Integer>> biFunc =
(val1,val2)->{
List<Integer> list = new ArrayList<Integer>();
int val001 = val2%10;
int val010 = val2/10%10;
int val100 = val2/100;
list.add( val1*val001);
list.add( val1*val010);
list.add( val1*val100);
list.add( val1*val2);
return list;
};
List<Integer> resultList = calc(value1, value2, biFunc);
for(Integer val : resultList) {
System.out.println(val);
}
}
public static List<Integer> calc(int a, int b, BiFunction<Integer, Integer, List<Integer>> biFunc){
return biFunc.apply(a, b);
}
}
핵심
자바의 정수형 연산 시 소수점 버림 활용 법