public class Test3{
public static void main(String[] args){
int[] arr = {1,2,5,7,3,4,8,6};
//排序 1
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;
}
}
}
//排序 2
for(int i = arr.length-1; i>0; i--){
for(int j=0; j<i; j++){
if(arr[i] > arr[j]){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
//排序 3
int k = arr.length;
boolean flag = true;
while (flag) {
flag = false;
for (int i = 0; i < k-1; i++) {
if (arr[i] < arr[i+1]) {
int temp = arr[i];
arr[i] = arr[i+1];
arr[i+1] = temp;
flag =true;
}
}
k--;
}
for (int i : arr) {
System.out.print(i+" ");
}
}
}