Here you can find the source of avg(final double... values)
public static double avg(final double... values)
//package com.java2s; /**/* w w w . j a v a 2 s. co m*/ * Copyright? 2014-2016 LIST (Luxembourg Institute of Science and Technology), all right reserved. * Authorship : Olivier PARISOT, Yoanne DIDRY * Licensed under GNU General Public License version 3 */ public class Main { public static double avg(final double... values) { return sum(values) / values.length; } public static double sum(final double... values) { double result = 0d; for (final double value : values) result += value; return result; } public static long sum(final long... values) { long result = 0; for (final long value : values) result += value; return result; } }