Java examples for java.lang:Math Calculation
Computes the set mean.
//package com.java2s; import java.util.Collection; public class Main { /**//from w ww . ja v a 2 s . com * Computes the set mean. * @param c Values set. * @return Return the average value of the set. */ public static double mean(Collection<Double> c) { double sum = 0.0; for (Double t : c) { sum += t; } return sum / c.size(); } }