Here you can find the source of max(double[] a)
public static double max(double[] a)
//package com.java2s; //License from project: Open Source License public class Main { public static double max(double[] a) { return a[maxInd(a)]; }//from w w w . j a v a 2 s . com public static int maxInd(double[] a) { double max = Double.NEGATIVE_INFINITY; int maxInd = -1; for (int i = 0; i < a.length; i++) { if (a[i] > max) { maxInd = i; max = a[i]; } } return maxInd; } }