标签:
[ 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);
zenefits oa - sort integer array in lexographical order
标签:
原文地址:http://www.cnblogs.com/marc-leetcode/p/5175009.html