Here you can find the source of avgOfArray(double[] array)
public static double avgOfArray(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static double avgOfArray(double[] array) { double sum = 0; for (double x : array) { sum += x;//www . j a v a2 s . c o m } if (sum == 0) return 0; else return sum / array.length; } }