Answers for "get the max value from arrayList java and save it in int"

0

get the max value from arrayList java and save it in int

List<Integer> list = new ArrayList<>(); // Creating List
   list.add(3); //add elements
   list.add(6);
   list.add(9);
int maxNum = Collections.max(list); //save the biggest element in variable
System.out.println(max); //print 9
Posted by: Guest on February-14-2022

Code answers related to "get the max value from arrayList java and save it in int"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language