简单冒泡排序
public static void main(String[] args) {
int[] numbers = {1, 98, 89, 24, 53, 89, 23, 123, 42};
for (int i = 0; i < numbers.length-1; i++) {
for (int j = 0; j < numbers.length-i-1; j++) {
if (numbers[j]>numbers[j+1]){//从小到大,如要从大到小改表达式>即可
int temp=numbers[j];
numbers[j]=numbers[j+1];
numbers[j+1]=temp;
}
}
}
System.out.println(Arrays.toString(numbers));
}