Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

greatest element in array in java

private static int largest(int[] arr) { 
	int i = 0;
	int index = 0;
	for(int c = 0;c < arr.length;c++){
		if(i < arr[c]){
			i = arr[c];
			index = c;
		}
	}
	return i; 
 }
 
PREVIOUS NEXT
Tagged: #greatest #element #array #java
ADD COMMENT
Topic
Name
8+4 =