public void sortNumber(){
int [] numberList = {2,8,1,9,3,10,4,6,5,7};
for(int i = 0;i< numberList.length-1;i++){
for(int j= 0 ; j< numberList.length-1;j++){
if(numberList[j]>numberList[j+1]){
int tmp = 0;
tmp = numberList[j];
numberList[j] = numberList[j+1];
numberList[j+1] = tmp;
}
}
}
String aa = Arrays.toString(numberList);
System.out.println(aa);
}
简单冒泡排序笔记
于 2023-03-08 13:57:14 首次发布