import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class RapidSort {
private Random ran = new Random(); // 声明一个全局变量ran,用来随机生成整数
private void sortArray() {
int[] array = new int[10]; // 声明数组长度为10
for (int i = 0 ; i < array.length; i++) {
array[i] = ran.nextInt(10) + 1; // 数组赋值
}
Arrays.sort(array);
System.out.println(Arrays.toString(array));
}
private void sortList() {
List
for (int i = 0 ; i < 10; i++) {
list.add(ran.nextInt(10) + 1); // 给集合赋10个值
}
Collections.sort(list);
System.out.println(list);
}
public static void main(String[] args) {
RapidSort rs = new RapidSort();
rs.sortArray();
rs.sortList();
}
}