Java tutorial
import java.math.BigDecimal; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws Exception { Stream.of(new BigDecimal("1.2"), new BigDecimal("3.7")).mapToDouble(BigDecimal::doubleValue).average() .ifPresent(System.out::println); } }