In Java, calculate the maximum and minimum values in List <double []>, javadouble
If you need to reprint please indicate the source: http://blog.csdn.net/itas109
QQ technology exchange group: 129518033
Reference: http://stackoverflow.com/questions/8093163/min-max-values-of-a-listdouble
There is an array as follows, and the maximum and minimum values are obtained.
List<double[]> values = new ArrayList<double[]>();values.add(new double[] { 12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2, 13.9 });values.add(new double[] { 10, 10, 12, 15, 20, 24, 26, 26, 23, 18, 14, 11 });values.add(new double[] { 5, 5.3, 8, 12, 17, 22, 24.2, 24, 19, 15, 9, 6 });values.add(new double[] { 9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10 });
Maximum value:
public double ListDoubleArrayMax(List<double[]> dataList) {double max = Double.MIN_VALUE;for (double[] ds : dataList) {for (double d : ds) {if (d > max) {max = d;}}}return max;}
Minimum value:
public double ListDoubleArrayMin(List<double[]> dataList) {double min = Double.MAX_VALUE;for (double[] ds : dataList) {for (double d : ds) {if (d < min) {min = d;}}}return min;}
If you need to reprint please indicate the source: http://blog.csdn.net/itas109
QQ technology exchange group: 129518033