import java.util.*;
class Solution {
public int[] solution(long n) {
String temp = Long.toString(n);
int[] answer = new int[temp.length()];
for (int i = 0; i < temp.length(); i++) answer[temp.length() - 1 - i] = temp.charAt(i) - '0';
return answer;
}
}
역순으로 배열을 생성해야 하기 때문에 각자릿수를 answer에 할당해줄 때 temp의 첫번째 문자가 answer의 마지막 원소로 들어가는 식으로 진행되도록 temp.length() - 1 - i로 인덱스값 접근식을 적어주면 된다.