[ 12 | 2434 | 23 | 1 | 654 | 222 | 56 | 100000 ]
Then the output should be:
[ 1 | 100000 | 12 | 222 | 23 | 2434 | 56 | 654 ]
建立自己的comparator:
Comparator<Integer> intLexCompare = new Comparator<Integer>() {
int compareTo( Integer x, Integer y) {
return x.toString().compareTo(y.toString();
}
}
Arrays.sort(nums, intLexCompare);
时间: 2024-08-26 14:13:25