Java IntStream reduce to product
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); int r = intStream.reduce(1, (x, y) -> x * y); // product of values with reduce method System.out.printf("Product via reduce method:"+r); }//from ww w.j a va 2s . c om }