Java IntStream average
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("Average: %.2f%n", intStream.average().getAsDouble()); }/* w ww.jav a 2s. c o m*/ }