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如需轉載請自行聯系原作者
笑容掩飾愛