import java.util.Arrays;
public class Demo {
public static void main(String[] args) {
int[] Array = {2,23,32,4,54,17,19};
for (int i = 0; i < Array.length-1; i++) {
for (int j = i+1; j < Array.length; j++) {
if(Array[i] > Array[j]){
int temp = Array[i];
Array[i] = Array[j];
Array[j] = temp;
}
}
}
System.out.println(Arrays.toString(Array));
}
}
打印结果为:[2, 4, 17, 19, 23, 32, 54]