- class Util {
- public static List<Integer> max2Min(List<Integer> intList) {
- List<Integer> resultList = sort(intList);
- Collections.reverse(resultList);
- return resultList;
- }
- public static List<Integer> min2Max(List<Integer> intList) {
- List<Integer> resultList = sort(intList);
- return resultList;
- }
- public static List<Integer> sort(List<Integer> intList) {
- Integer[] intArray = intList.toArray(new Integer[intList.size()]);
- Arrays.sort(intArray);
- return Arrays.asList(intArray);
- }
- }
复制代码 |