排序法
冒泡排序法:
/**
* 冒泡排序法
*/
int[] array = {1,3,7,5,4,2};
int temp;
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array.length-1; j++) {
if(array[j] > array[j+1]){
temp= array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
}
System.out.println(Arrays.toString(array));
}