Here you can find the source of maxElementIndex(final double[] array)
public static int maxElementIndex(final double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static int maxElementIndex(final double[] array) { return maxElementIndex(array, array.length); }/*from ww w. ja v a 2 s . c om*/ public static int maxElementIndex(final double[] array, final int start, final int endIndex) { if (array == null || array.length == 0) throw new IllegalArgumentException("Array cannot be null!"); if (start > endIndex) { throw new IllegalArgumentException("Start cannot be after end."); } int maxI = start; for (int i = (start + 1); i < endIndex; i++) { if (array[i] > array[maxI]) maxI = i; } return maxI; } public static int maxElementIndex(final double[] array, final int endIndex) { return maxElementIndex(array, 0, endIndex); } }