Here you can find the source of avg(float... numbers)
public static float avg(float... numbers)
//package com.java2s; /*=========================================================================== COPYRIGHT 2013 Vin?cius G. Mendon?a ALL RIGHTS RESERVED. //from w ww .j av a 2 s. co m This software cannot be copied, stored, distributed without Vin?cius G. Mendon?a prior authorization. This file was made available on https://github.com/ViniGodoy and it is free to be redistributed or used under Creative Commons license 2.5 br: http://creativecommons.org/licenses/by-sa/2.5/br/ ============================================================================*/ public class Main { public static float avg(float... numbers) { return sum(numbers) / numbers.length; } public static float sum(float... numbers) { float sum = 0; for (float number : numbers) sum += number; return sum; } }