public class Demo02_冒泡排序{
public static void main(String[] args){
int[] i = {10,45,65,12,9,5,3,4,12,99};
for(int a=0;a<i.length;a++){
for(int j=0;j<i.length-1;j++){
if(i[j]>i[j+1]){
int max = i[j+1];
i[j+1]=i[j];
i[j]=max;
}
}
}
for(int p=0;p<i.length;p++){
System.out.println(i[p]);
}
}
}
转载于:https://my.oschina.net/u/3389862/blog/873663