Java经典代码-冒泡排序


/**
 * @author ManScript
 *
 */

public class Maopao {

static int [] scores={5,10,5,2,9,3,8};
public static void main(String[] args) {
for(int i=0;i for(int j=0;j if(scores[j]>scores[j+1]){
int temp=scores[j];
scores[j]=scores[j+1];
scores[j+1]=temp;
}
}
}
System.out.println(Arrays.toString(scores));
}


}

你可能感兴趣的:(经典代码)