static int[] Bubble(int []a){标签:大时,return,前面,int,冒泡排序,swap From: https://www.cnblogs.com/operationToJava2022/p/16979325.html
int swap;
if(a.length==0)return null;
for(int i=1;i<a.length;i++/*i是后面数的下标*/){
for (int j = 0; j < i; j++/*j是前面数的下标*/) {
//前面的数比后面大时,两数交换
if(a[j]>a[i]){
swap=a[i];
a[i]=a[j];
a[j]=swap;
}
}
}
return a;
}