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