Here you can find the source of average(BigDecimal... values)
public static BigDecimal average(BigDecimal... values)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { public static double average(double... values) { double sum = 0; for (double val : values) { sum += val; }//from w w w .j a v a2 s. c om return sum / values.length; } public static BigDecimal average(BigDecimal... values) { double sum = 0; for (BigDecimal val : values) { sum += val.doubleValue(); } return new BigDecimal(sum / values.length); } }