// 冒泡循环
public static void main(String [] args) {
int [] ns = {1, 3, 2, 7 ,9};
// 控制循环次数
for (int i = 0; i < ns.length -1; i++){
// 将最大的数放到末尾
for (int j = 0; j < ns.length -i -1; j++){
if (ns[j] > ns[j+1]) {
int tmp = ns[j];
ns[j] = ns[j+1];
ns [j+1] = tmp;
}
}
}
System.out.println(Arrays.toString(ns));
}