Here you can find the source of computeMean(float[] array)
Parameter | Description |
---|---|
array | the array |
public static float computeMean(float[] array)
//package com.java2s; /*// w w w . j av a 2 s. co m * Copyright (C) 2010-2014 Andreas Maier * CONRAD is developed as an Open Source project under the GNU General Public License (GPL). */ public class Main { /** * computes the mean of the array "values" on the interval [start, end]. * @param values the array * @param start the start index * @param end the end index * @return the mean value */ public static float computeMean(float[] values, int start, int end) { float revan = 0; for (int i = start; i <= end; i++) { revan += values[i]; } revan /= end - start + 1; return revan; } /** * Computes the mean value of a given array * @param array the array * @return the mean value as float */ public static float computeMean(float[] array) { float mean = 0; for (int i = 0; i < array.length; i++) { mean += array[i]; } return mean / array.length; } }