冒泡排序
import java.util.Arrays;
public class ArrayDemo06 {
public static void main(String[] args) {
int[] array={1,3,5,6,7,3,22,3412,4532,1334,2585,984};
sort(array);//实行排序
System.out.println(Arrays.toString(array));//打印排序后的数组
}
//冒泡排序方法
public static void sort(int[] array){
int temp=0;
for (int i=0;i<array.length-1;i++){
for(int j=i;j<array.length-1;j++){
if (array[j]>array[j+1]){
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
}
}
}