// 获取数组最大值 public static Double findMaxNum(List<String> arr) { Double max = Double.parseDouble(arr.get(0)); for (int i = 1; i <=arr.size()-1 ; i++) { if (max<Double.parseDouble(arr.get(i))){ max=Double.parseDouble(arr.get(i)); } } return max; } // 获取数组最小值 public static Double findMinNum(List<String> arr) { Double min = Double.parseDouble(arr.get(0)); for (int i = 1; i <=arr.size()-1 ; i++) { if (min>Double.parseDouble(arr.get(i))){ min=Double.parseDouble(arr.get(i)); } } return min; }
java获取list集合最大最小值
最新推荐文章于 2023-10-24 21:46:49 发布