Here you can find the source of maxIndex(double[] arr)
public static int maxIndex(double[] arr)
//package com.java2s; //License from project: Apache License public class Main { /**/* w w w . j a v a2 s . co m*/ * return index of maximal number */ public static int maxIndex(double[] arr) { if (arr.length <= 0) return -1; double max = Double.MIN_VALUE; int index = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; index = i; } } return index; } }