Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to get the highest value in a list java

import java.util.*;
public class CollectionsMaxExample2 {
public static void main(String[] args) {
//Create collections lists.
List<Integer> list = Arrays.asList(20, 10, 100, 140, 250);
Integer max = Collections.max(list);
System.out.println("Maximum element is: "+max);
}
 
PREVIOUS NEXT
Tagged: #highest #list #java
ADD COMMENT
Topic
Name
4+2 =