int min;
int[] oneArray = new int[] { 4, 2, 0, 8, 7, 1, 5, 9, 3, 6 };
for (int i = 0; i < oneArray.length - 1; i++) { // 循环oneArray.length
// - 1
// 次,每循环完一次,找出一个最大的放在最后
for (int j = 0; j < oneArray.length - i - 1; j++) { //
// 循环onrArray.length
// - i -
// 1次,每次循坏比较相邻两个大小,大的排在后面与下一个比较
if (oneArray[j] > oneArray[j + 1]) {
min = oneArray[j + 1];
oneArray[j + 1] = oneArray[j];
oneArray[j] = min;
// System.out.println(oneArray[j]);
// System.out.println(oneArray[j+1]);
}
}
// System.out.println(oneArray[i]);
}
for (int i = 0; i < oneArray.length; i++) {
System.out.println(oneArray[i]);
}