Advertisement
ralphdc09

itf103.finals-wk-14-wk-18.number03

Jun 9th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. package md.WK14toWK18;
  2.  
  3. import java.util.Arrays;
  4.  
  5. public class number03 {
  6.     public static void main(String[] args) {
  7.         int[] array = {10789, 2035, 1899, 1456, 2013};
  8.         System.out.println("Original number array : " + Arrays.toString(array));
  9.         Arrays.sort(array);
  10.         int index = array.length - 1;
  11.         while (array[index] == array[array.length - 1]) {
  12.             index--;
  13.         }
  14.         System.out.println("Second largest value: " + array[index]);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement