Java mean mean(float[] xs)

Here you can find the source of mean(float[] xs)

Description

mean

License

Apache License

Declaration

public static float mean(float[] xs) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static float mean(float[] xs) {
        if (xs == null || xs.length == 0)
            throw new IllegalArgumentException("Input to mean() is an empty array");

        float sum = 0.0f;

        for (int i = 0; i < xs.length; ++i)
            sum += xs[i];//w  w  w. j  ava2 s.  c o  m

        return sum / (float) xs.length;
    }

    public static float mean(float x, float y) {
        return (x + y) * 0.5f;
    }
}

Related

  1. mean(final int[] values)
  2. mean(float a, float b)
  3. mean(float[] a, int off, int length)
  4. mean(float[] arr)
  5. mean(float[] array)
  6. mean(int low, int high)
  7. mean(int N, int D, double dat[][], double mu[])
  8. mean(int... values)
  9. mean(int[] array)