package com.cos.lession08.demo4;
import java.util.Arrays;
public class MaoPaoDemo {
public static void main(String[] args) {
int[] a = { 65, 54, 87, 23, 42, 77, 55, 15, 88, 99 };
System.out.println(Arrays.toString(a));
for (int i = 0; i < a.length - 1; i++) {
for (int j = 0; j < a.length - 1 - i; j++) {
// 比较 交换 //升序
// if (a[j] if (a[j] > a[j + 1]) {
int temp = a[j + 1];
a[j + 1] = a[j];
a[j] = temp;
}
}
}
System.out.println(Arrays.toString(a));
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)