冒泡排序的实现。 class BubbleSort{ public void bubble(int[] a){ int temp; for(int i=a.length-1;i>=0;i--){ for(int j=0;j<i;j++){ if(a[j]>a[j+1]){ //交换 temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } } }