List of usage examples for java.util.stream IntStream sum
int sum();
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3); int d = i.sum(); System.out.println(d);/*from w w w . j a v a2 s.c o m*/ }
From source file:Main.java
public static void main(String[] args) { int[] numbers = { 2, 3, 5, 7, 11, 13 }; IntStream intStream = Arrays.stream(numbers); intStream = intStream.limit(3);// w ww. ja va 2s. co m System.out.println(intStream.sum()); }