https://school.programmers.co.kr/learn/courses/30/lessons/12933
String[] arr = (Long.toString(n)).split("");
-> Long형을 문자열로 바꿔서 문자열배열로 잘라넣기
Arrays.sort(arr,Collections.reverseOrder());
-> 내림차순 배열
answer = Long.parseLong(s);
-> "81231" -> 81231(long형)
import java.util.*;
class Solution {
public long solution(long n) {
long answer = 0;
String[] arr = (Long.toString(n)).split("");
Arrays.sort(arr,Collections.reverseOrder());
String s = "";
for(String i: arr){
s += i;
}
answer = Long.parseLong(s);
return answer;
}
}