public static void bubbleSort(int[] array) {
//此时最外层控制的就是趟数
for (int i = 0; i < array.length-1; i++) {
//-i 每一次比上一次上一个比较
boolean flg = false;
for (int j = 0; j < array.length-1-i; j++) {// 0 < 4
if(array[j] > array[j+1]) {
int tmp = array[j];
array[j] = array[j+1];
array[j+1] = tmp;
flg = true;
}
}
if(flg == false) {
return;
}
}
}