package com.zzy.maopao;
public class paixun {
public static void main(String[] arge){
int[] array = {63,4,2,5,15,99,88,77,33};
paixun px = new paixun();
px.sort(array);
}
private void sort(int[] array) {
// TODO Auto-generated method stub
for(int i=1;i<array.length; i++){
for(int j=0; j<array.length-i;j++){
if(array[j]>array[j+1]){
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
}
showArray(array);
}
public void showArray(int[] array){
for(int i:array){
System.out.println(">"+i);
}
System.out.println();
}
}
后台粘贴出来结果:
>2 >4 >5 >15 >33 >63 >77 >88 >99
本文转自12691034博客51CTO博客,原文链接http://blog.51cto.com/12701034/1929912如需转载请自行联系原作者
笑容掩饰爱