数据排序:http://www.365mini.com/page/tag/%E6%95%B0%E6%8D%AE%E6%8E%92%E5%BA%8F
//冒泡排序
int[] arr={123,223,66,883,223,34,763,256,44,99,88};
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr.length-1-i;j++){
if(arr[j]>arr[j+1]){
int temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
System.out.println("冒泡排序:"+Arrays.toString(arr));
//选择排序
int[] arr1={123,223,66,883,223,34,763,256,44,99,88};
for(int i=0;i<arr1.length;i++){
for(int j=i+1;j<arr1.length;j++){
if(arr1[i]>arr1[j]){
int temp=arr1[j];
arr1[j]=arr1[i];
arr1[i]=temp;
}
}
}
System.out.println("选择排序:"+Arrays.toString(arr1));
//插入排序
int[] arr2={123,223,66,883,223,34,763,256,44,99,88};
for(int i=0;i<arr2.length;i++){
for(int j=0;j<i+1;j++){
if(arr2[j]>arr2[i]){
int temp=arr2[i];
arr2[i]=arr2[j];
arr2[j]=temp;
}
}
}
System.out.println("插入排序:"+Arrays.toString(arr2));
}