public class kownledge {
public int[] bubble_sort(int [] ary) {
for(int i=0;i<ary.length-1;i++){
for(int j=0;j<ary.length-1-i;j++){
if(ary[j]>ary[j+1]){
int temp=ary[j];
ary[j]=ary[j+1];
ary[j+1]=temp;
}
}
}
return ary;
}
public static void main(String[] args) {
int [] ary={8,9,4,2,3,1,6,44,1200,1,0};
kownledge k = new kownledge();
ary=k.bubble_sort(ary);
//Arrays.toString()的意思是:返回指定数组内容的字符串表示形式。
System.out.println(Arrays.toString(ary));
}
}