public static void main(String[] args) throws Exception{
int [] a = {1,58,97,256,14,269,48,2,5,6,4,6,8};
//冒泡
for(int i =0;i<a.length;i++){
for(int j = 1;j<a.length-i-1;j++){
if(a[j]>a[j+1]){
int temp = a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(int i=0;i<a.length;i++){
System.out.print(a[i]+" ");
}
System.out.println("");
System.out.println("++++++++++++++++++++++++++++++++++++");
int [] b = {1,58,97,256,14,269,48,2,5,6,4,6,8};
//插入排序
for (int i = 1; i < b.length; i++) {
for (int j = i; j > 0 &&b[j-1]>b[j]; j--) {
int temp = b[j];
b[j] = b[j - 1];
b[j - 1] = temp;
}
}
for(int i=0;i<b.length;i++){
System.out.print(b[i]+" ");
}
}