How to find second largest number in an array?
Language = Java
Answers
Answered by
1
Answer:
1]import java.util.*;
2]public class SecondLargestInArrayExample2{
3]public static int getSecondLargest(Integer[] a, int total){
4]List<Integer> list=Arrays.asList(a);
5]Collections.sort(list);
6]int element=list.get(total-2);
7]return element;
8] }
Mark me Brainliest!!
: )
Similar questions