Here you can find the source of avg(double[] nums)
public static double avg(double[] nums)
//package com.java2s; //License from project: Apache License public class Main { public static double avg(double[] nums) { double sum = 0; for (double n : nums) sum += n;//from w ww. ja v a2s . com return sum / nums.length; } public static double avg(long[] nums) { long sum = 0; for (long n : nums) sum += n; return sum / nums.length; } }