Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package md.WK14toWK18;
- import java.util.Arrays;
- public class number03 {
- public static void main(String[] args) {
- int[] array = {10789, 2035, 1899, 1456, 2013};
- System.out.println("Original number array : " + Arrays.toString(array));
- Arrays.sort(array);
- int index = array.length - 1;
- while (array[index] == array[array.length - 1]) {
- index--;
- }
- System.out.println("Second largest value: " + array[index]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement