Java mean mean(final double[] in, final int start, final int stop)

Here you can find the source of mean(final double[] in, final int start, final int stop)

Description

Calculate the mean of an array of doubles.

License

Open Source License

Declaration

public static double mean(final double[] in, final int start, final int stop) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /** Calculate the mean of an array of doubles. */
    public static double mean(final double[] in, final int start, final int stop) {
        if ((stop - start) <= 0)
            return Double.NaN;

        double total = 0;
        for (int i = start; i < stop; ++i) {
            total += in[i];//from  www.j  ava2s  .  c  o m
        }

        return total / (stop - start);
    }
}

Related

  1. mean(double[][] matrix)
  2. mean(double[][] o)
  3. mean(final double[] a)
  4. mean(final double[] data, final boolean noNaN)
  5. mean(final double[] expected, final int begin, final int end)
  6. mean(final double[] values)
  7. mean(final double[] vec)
  8. mean(final int[] scores)
  9. mean(final int[] values)