Here you can find the source of mean(Double totalValue, int numValues)
Parameter | Description |
---|---|
totalValue | total value of the number. |
numValues | number of values. |
public static Double mean(Double totalValue, int numValues)
//package com.java2s; /**//from w ww. ja v a2 s .com * Copyright 5AM Solutions Inc, ESAC, ScenPro & SAIC * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/caintegrator/LICENSE.txt for details. */ public class Main { /** * Retrieves mean value of the list of floats. * * @param totalValue total value of the number. * @param numValues number of values. * @return mean value. */ public static Double mean(Double totalValue, int numValues) { return numValues != 0 ? totalValue / numValues : 0; } /** * Retrieves mean value of the list of floats. * * @param values of values. * @return mean value. */ public static float mean(float[] values) { float totalNumber = 0.0f; for (float value : values) { totalNumber += value; } return values.length == 0 ? 0 : totalNumber / values.length; } }