second largest value in array java 8

Solutions on MaxInterview for second largest value in array java 8 by the best coders in the world

showing results for - "second largest value in array java 8"
Hadrien
10 Apr 2017
1public class ThirdLargestNumberInAnArray {
2   public static void main(String args[]){
3      int temp, size;
4      int array[] = {10, 20, 25, 63, 96, 57};
5      size = array.length;
6
7      for(int i = 0; i<size; i++ ){
8         for(int j = i+1; j<size; j++){
9
10            if(array[i]>array[j]){
11               temp = array[i];
12               array[i] = array[j];
13               array[j] = temp;
14            }
15         }
16      }
17      System.out.println("Third second largest number is:: "+array[size-2]);
18   }
19}