static int indexOfMaxEntryInIntArray(int[] a) { int bestIndex = -1, bestValue = Int.MIN_VALUE; int n = l(a); for i to n: { int x = a[i]; if (x > bestValue) { bestIndex = i; bestValue = x; } } ret bestIndex; }