Here you can find the source of maxIndex(int[] a)
public static int maxIndex(int[] a)
//package com.java2s; //License from project: GNU General Public License public class Main { public static int maxIndex(int[] a) { int currentMax = a[0]; int currentMaxIndex = 0; for (int i = 1; i < a.length; i++) { if (a[i] > currentMax) { currentMax = a[i];//from w w w . j av a 2 s . co m currentMaxIndex = i; } } return currentMaxIndex; } public static int maxIndex(double[] a) { double currentMax = a[0]; int currentMaxIndex = 0; for (int i = 1; i < a.length; i++) { if (a[i] > currentMax) { currentMax = a[i]; currentMaxIndex = i; } } return currentMaxIndex; } }