I\'m just practicing some MIT java assignments. But, I\'m not sure how to find the second largest number. http://ocw.csail.mit.edu/f/13
public class Marath
Find the second largest element in the given array:
public static void findSecondMax(){
int[] arr = {3, 2, 20, 4, 1, 9, 6, 3, 8};
int max = 0;
int secondMax = 0;
for(int i =0; i< arr.length; i++) {
if(max < arr[i]) max = arr[i];
if((max > arr[i]) && (secondMax < arr[i])) secondMax = arr[i];
}
System.out.println(secondMax);
}