TreeMap<String, Integer> map = new TreeMap<String, Integer>();
map = randomNumber(arr);
//检查随机情况,打印出来已经是升序的了
for(Map.Entry<String, Integer> i : map.entrySet()) {
System.out.println(i);
}
}
//获取50个随机数,并返回一个Map
public static TreeMap<String, Integer> randomNumber(String[] arr) {
TreeMap<String, Integer> map = new TreeMap<String, Integer>();
Random r = new Random();
for(int i=0; i<50; i++) {
int number = r.nextInt(41);
String key = arr[number];
Integer look = map.get(key);