int[] arr = new int[]{0,1,3,2,4,5,6,7,9,8};
int i,j,temp;
for(i=1;i<arr.length;i++){//
外围比较趟数i:1到length-1 for(j=0;j<arr.length-i;j++){//
每趟的内比次数j:与趟数i有规律 if(arr[j]>arr[j+1]){
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
for(int k=0;k<arr.length;k++){
System.out.print(arr[k]+",");
}