Here you can find the source of minMax(float[] array)
Find the minimum and maximum values in an array.
Parameter | Description |
---|---|
array | the array |
static public float[] minMax(float[] array)
//package com.java2s; public class Main { /**// www .j a v a 2 s . c o m * <p>Find the minimum and maximum values in an array.</p> * * @param array the array * @return an array of two values, the first being the minimum and the second the maximum values found */ static public float[] minMax(float[] array) { float min = Float.MAX_VALUE; float max = Float.MIN_VALUE; for (float v : array) { if (v < min) min = v; if (v > max) max = v; } float[] returnValues = { min, max }; return returnValues; } }