Java mean mean(int... values)

Here you can find the source of mean(int... values)

Description

mean

License

Open Source License

Declaration

public static double mean(int... values) 

Method Source Code

//package com.java2s;

public class Main {
    public static double mean(int... values) {
        return sum(values) / values.length;
    }//www . j a  va  2s . c o m

    public static float mean(long... values) {
        return sum(values) / values.length;
    }

    public static double mean(double... values) {
        return sum(values) / values.length;
    }

    public static int sum(int... values) {
        int sum = 0;
        for (int i = 0; i < values.length; i++) {
            sum += values[i];
        }
        return sum;
    }

    public static long sum(long... values) {
        long sum = 0L;
        for (int i = 0; i < values.length; i++) {
            sum += values[i];
        }
        return sum;
    }

    public static double sum(double... values) {
        double sum = 0.0;
        for (int i = 0; i < values.length; i++) {
            sum += values[i];
        }
        return sum;
    }
}

Related

  1. mean(float[] arr)
  2. mean(float[] array)
  3. mean(float[] xs)
  4. mean(int low, int high)
  5. mean(int N, int D, double dat[][], double mu[])
  6. mean(int[] array)
  7. mean(int[] input)
  8. mean(int[] values)
  9. mean(int[] values, int max)