1 int[] x={1,6,4,8,6,9,12,32,76,34,23};
升序:
1 Arrays.sort(x);
降序:
1 resort(x); 2 public int[] resort(int[] num){ 3 Arrays.sort(num); 4 int[] resort=new int[num.length]; 5 for(int j=0;j<num.length;j++){ 6 resort[j]=num[num.length-1-j]; 7 } 8 return resort; 9 }
时间: 2024-08-09 03:04:57