public class SecondHighestElement {
public static void main(String args[]){
int a[]={1,2,46,672,24,5,6,46,672};
System.out.println("Second Highest Element"+secHighestElement(a));
}
private static int secHighestElement(int[] a) {
int first=0,second=0;
for(int i=0;i<a.length;i++){
if (first <a[i]){
second=first;
first=a[i];
}
if(second<a[i] && first!=a[i])
second=a[i];
}
return second;
}
}