Here you can find the source of minmax(int[] values)
public static int[] minmax(int[] values)
//package com.java2s; /* ****************************************************************************** * // w w w . j a v a 2 s . com * This file is part of JMH * * License: * EPL: http://www.eclipse.org/legal/epl-v10.html * LGPL 3.0: http://www.gnu.org/licenses/lgpl-3.0-standalone.html * See the LICENSE file in the project's top-level directory for details. * * **************************************************************************** */ public class Main { public static int[] minmax(int[] values) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for (int value : values) { if (value < min) { min = value; } if (value > max) { max = value; } } return new int[] { min, max }; } public static double[] minmax(double[] values) { double min = Integer.MAX_VALUE; double max = Integer.MIN_VALUE; for (double value : values) { if (value < min) { min = value; } if (value > max) { max = value; } } return new double[] { min, max }; } }