Java tutorial
//package com.java2s; public class Main { public static int maxIndex(double[] input) { return maxIndex(input, input.length); } public static int maxIndex(double[] input, int limit) { double max = Double.MIN_VALUE; int index = -1; for (int i = 0; i < input.length && i < limit; i++) { if (input[i] > max) { max = input[i]; index = i; } } return index; } }