greatest element in array in java

Solutions on MaxInterview for greatest element in array in java by the best coders in the world

showing results for - "greatest element in array in java"
Jesús
08 Aug 2019
1private static int largest(int[] arr) { 
2	int i = 0;
3	int index = 0;
4	for(int c = 0;c < arr.length;c++){
5		if(i < arr[c]){
6			i = arr[c];
7			index = c;
8		}
9	}
10	return i; 
11 }