Stream.max method
package app;
import java.util.Arrays;
public class Main
{
public static void main(String[] args)
{
Integer[] numbers = {10, 3, 17, 50, 15};
Integer maxNumber = Arrays.stream(numbers).max(Integer::compare).get();
System.out.println(maxNumber);
}
}
Leave a Comment
Cancel reply