Here you can find the source of findMinAndMax(double[] array)
public static Map<Double, Double> findMinAndMax(double[] array)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; public class Main { public static Map<Double, Double> findMinAndMax(double[] array) { double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; for (int i = 0; i < array.length; i++) { if (array[i] < min) { min = array[i];// w w w .j a va2 s. c o m } if (array[i] > max) { max = array[i]; } } Map<Double, Double> result = new HashMap<>(); result.put(Double.MIN_VALUE, min); result.put(Double.MAX_VALUE, max); return result; } }