public static int secondHighnestNum(int[] array){
if(array == null || array.length == 0) return -1;
int first, second;
first = second = Integer.MIN_VALUE;
for(int i=0; i first){
second = first;
first = array[i];
}
else if(array[i] > second && array[i] != first){
second = array[i];
}
}
if(second == Integer.MIN.VALUE){
return -1;
}
return second;
}