import java.util.*;
import java.util.stream.*;
class Solution {
public int[] solution(long n) {
List<Integer>list= Arrays.stream(String.valueOf(n).split("")).map(Integer::parseInt).collect(Collectors.toList());
Collections.reverse(list);
return list.stream().mapToInt(Integer::intValue).toArray();
}
}
1.String.valueOf(n).split("") 문자열로 만들어 배열로 만들다.
2.map(Integer::parseInt) 문자열을 Int형으로 변경한다.
3.collect(Collectors.toList()) Collection 중 List형태로 반환한다.
4.Collections.reverse(list); reverse 정렬 한다.
5.list.stream().mapToInt(Integer::intValue).toArray(); Integer를 int로 만들어 배열로 반환한다.