Here you can find the source of mean(double values[])
Parameter | Description |
---|---|
values | the vector |
public static double mean(double values[])
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww. jav a2s. c om * Computes average of the elements of the vector. * @param values the vector * @return the average of the elements of the vector */ public static double mean(double values[]) { double sum = 0; for (double value : values) sum += value; return sum / values.length; } /** * Computes average of the elements of the vector. * @param values the vector * @return the average of the elements of the vector */ public static double mean(int values[]) { double sum = 0; for (int value : values) sum += value; return sum / values.length; } }