public double [ ] getMinMax ( double [ ] array ) { double [ ] minmax = new double [ 2 ] ; double max = Double . MIN_VALUE ; double min = Double . MAX_VALUE ; for ( double value : array ) { if ( value > max ) max = value ; if ( value < min ) min = value ; } minmax [ 0 ] = min ; minmax [ 1 ] = max ; return minmax ; }
Returns an array of size 2 with min and max values of given double array