Here you can find the source of max(int[] arr)
public static int max(int[] arr)
//package com.java2s; //License from project: Open Source License public class Main { public static int max(int[] arr) { int maxIndex = 0; int maxValue = arr[0]; for (int i = 1; i < arr.length; i++) { if (maxValue < arr[i]) { maxIndex = i;// ww w . ja v a 2 s . co m maxValue = arr[i]; } } return maxIndex; } }