package test;
public class Maopao {
public static void main(String[] args) {
array(new int[] { 6, 73, 23, 15, 45, 20, 56, 3, 89 });
}
public static void array(int arr[]) {
for (int j = 0; j < arr.length; j++) {
for (int i = 0; i < arr.length - 1 - j; i++) {
if (arr[i] > arr[i + 1]) {
int x = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = x;
}
}
}
for (int j = 0; j < arr.length; j++) {
System.out.printf("第%d输出:%d\n", j, arr[j]);
}
System.out.println("");
for (int k : arr) {
System.out.print(k + " ");
}
}
}