public class Select {
public static void main(String[] args) {
selectArray(new int[] { 6, 73, 23, 15, 45, 20, 56, 3, 89 });
}

public static void selectArray(int[] arr) {
for (int i = 0; i < arr.length - 1; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (arr[i] >= arr[j]) {
int min = arr[j];
arr[j] = arr[i];
arr[i] = min;
}
}
System.out.println("第" + (i + 1) + "次最小的" + arr[i]);
}
for (int k : arr) {
System.out.print(k + " ");
}
}
}