Arrays.sort()使用
//被排序的字符串数组
String[] months = {"January","February","March","April","May","June","July","August","September","October","December"};
//按字符串长度排序
//1.
Arrays.sort(months, (a, b) -> Integer.signum(a.length() - b.length()));
//2.
Arrays.sort(months, Comparator.comparingInt(String::length));
//3.
Arrays.sort(months, (a, b) -> a.length() - b.length());//表示若这表达式大于0则a放前面
//4.
Arrays.sort(months,(String a, String b) -> { return Integer.signum(a.length() - b.length()); });