不能排对象
public static int[] sort(int[] arr){
int[] result = new int[arr.length];
int[] count = new int[10];
for (int i = 0; i < arr.length; i++){ //此处可用增强for
count[arr[i]]++;
}
// for (int i = 0, j = 0; i < count.length; i++ ){
// while(count[arr[i]]-- > 0) result[j++] = i;
// }
for (int i = 1; i < count.length; i++){
count[i] = count[i] + count[i-1];
}
for (int i = arr.length - 1; i >= 0; i--){
result[--count[arr[i]]] = arr[i];
}
return result;
}