Java IntStream sum

Description

Java IntStream sum

import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0};

    IntStream intStream = IntStream.of(values);
    System.out.printf("Sum: %d%n", intStream.sum());

  }//from  w w w  . j  av a2  s.  c o m
}



PreviousNext

Related