工具类Collections
public class Test1 { public static void main(String[] args){ List<String> list = new ArrayList<>(); Collections.addAll(list, "95","91","94","93","92","90"); System.out.println(list);//[95, 91, 94, 93, 92, 90] Collections.sort(list); System.out.println(list);//[90, 91, 92, 93, 94, 95] Collections.sort(list,new Comparator<String>() { @Override public int compare(String str1, String str2) { int a = Integer.parseInt(str1); int b = Integer.parseInt(str2); if(a>b){ return -1; } if(a<b){ return 1; } return 0; } }); System.out.println(list);//[95, 94, 93, 92, 91, 90] } }