Java Array Average avgOfArray(double[] array)

Here you can find the source of avgOfArray(double[] array)

Description

avg Of Array

License

Open Source License

Declaration

public static double avgOfArray(double[] array) 

Method Source Code

//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;
    }
}

Related

  1. avg(int[][] values)
  2. avgarr(int[] a)
  3. avgArray(double[] values, int maxLength)
  4. avgArrayAndDouble(double[] array, double doublevalue)
  5. avgIgnoreNaN(double[] values)
  6. avgRng(double[] high, double[] low, int days)
  7. getAverage(double[] values)
  8. getAverage(int[] values)
  9. zero(double[][] A)