一、数组的排序 - 冒泡排序
1.口诀
N个数字来排序
两两相比小靠前
外层循环N-1
内层循环N-1-i
2.自学各种排序
https://www.cnblogs.com/c1024/p/11012049.html
public static void main(String[] args){
int[] is = {39,77,27,20,45,62};
for(int i = 0;i<is.length-1;i++){
for(int j = 0;j<is.length-1-i;j++){
if(is[j] > is[j+1]){
int temp = is[j];
is[j] = is[j+1];
is[j+1] = temp;
}
}
}
for(int num : is){
System.out.println(num);
}
}
}