1.冒泡排序
public class MaoPaoPaiXu {
public static void main(String[] args){
int[] arr=new int[]{43,22,12,32,1,75,2,99,0};
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+" ");
}
System.out.println();
int temp;
for(int i=0;i<arr.length-1;i++){
for(int j=0;j<arr.length-1-i;j++){
if(arr[j]>arr[j+1]){
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
System.out.print("经过冒泡排序后:");
for(int i=0;i<arr.length;i++){
System.out.print(arr[i]+" ");
}
}
}