Here you can find the source of maxIndex(double[] arrays)
public static int maxIndex(double[] arrays)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { public static int maxIndex(double[] arrays) { int mIdx = -1; double maxValue = -Double.MAX_VALUE; for (int i = 0; i < arrays.length; i++) { if (arrays[i] > maxValue) { maxValue = arrays[i];//from w w w . j av a 2 s . c om mIdx = i; } } return mIdx; } public static int maxIndex(int[] counts) { int mIdx = -1; double maxValue = -Integer.MAX_VALUE; for (int i = 0; i < counts.length; i++) { if (counts[i] > maxValue) { maxValue = counts[i]; mIdx = i; } } return mIdx; } public static int maxIndex(ArrayList<Double> list) { int mIdx = -1; double maxValue = -Double.MAX_VALUE; for (int i = 0; i < list.size(); i++) { if (list.get(i) > maxValue) { maxValue = list.get(i); mIdx = i; } } return mIdx; } }