你们说的好复杂,直接选排不就好了
public static void main(String[] args) {
int [] arr={58,34,12,8,3,47,63,14};
for(int i = 0 ; i < (arr.length - 1); i ++) {
for(int j = i + 1 ; j < arr.length ; j ++ ){
if (arr[i] < arr[j]) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
for (int i = 0 ; i < arr.length; i ++) {
System.out.println(arr[i]);
}
|