mean value from double array - Android java.lang

Android examples for java.lang:array calculation

Description

mean value from double array

Demo Code


//package com.java2s;

public class Main {
    public static double mean(double[] a) {
        double sum = 0;
        for (double i : a) {
            sum += i;/*from   w ww . j  av  a2  s. c  o m*/
        }
        return sum / a.length;
    }
}

Related Tutorials