1 public static void maopaoSort(int[] array){ 2 for(int i = 0 ; i < array.length ; i++){ 3 for(int j = i+1;j < array.length ; j++){ 4 if(array[i] > array[j]){ 5 int temp = array[i]; 6 array[i] = array[j]; 7 array[j] = temp; 8 } 9 } 10 } 11 }
1 public static void maopaoSort(int[] array){ 2 for(int i = 0 ; i < array.length ; i++){ 3 for(int j = i+1;j < array.length ; j++){ 4 if(array[i] > array[j]){ 5 int temp = array[i]; 6 array[i] = array[j]; 7 array[j] = temp; 8 } 9 } 10 } 11 }
转载于:https://www.cnblogs.com/cowshed/p/11397668.html