Java Array Average average(int... values)

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

Description

Gets the rounded average of all the integer values given

License

Open Source License

Declaration

public static int average(int... values) 

Method Source Code

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

public class Main {
    /**// w  ww .  jav  a 2  s.com
     * Gets the rounded average of all the integer values given
     */
    public static int average(int... values) {
        int total = 0;
        for (int v : values)
            total += v;
        return Math.round((float) total / (float) values.length);
    }
}

Related

  1. average(final T p_num1, final T p_num2)
  2. average(float[][] data, int startIndex, int endIndex)
  3. average(float[][] originalValues, float[][] newValues, int[] indexArray)
  4. average(int argb0, int argb1)
  5. average(int... is)
  6. average(int[] a)
  7. average(int[] array)
  8. average(int[] pixels)
  9. average(int[] pixels)