Android Array Average average(double[] pixels)

Here you can find the source of average(double[] pixels)

Description

average

Declaration

public static int average(double[] pixels) 

Method Source Code

//package com.java2s;

public class Main {

    public static int average(int[] pixels) {
        float m = 0;
        for (int i = 0; i < pixels.length; ++i) {
            m += pixels[i];//from  w  ww.  j  a v  a 2  s.  c o  m
        }
        m = m / pixels.length;
        return (int) m;
    }

    public static int average(double[] pixels) {
        float m = 0;
        for (int i = 0; i < pixels.length; ++i) {
            m += pixels[i];
        }
        m = m / pixels.length;
        return (int) m;
    }
}

Related

  1. getArrayAvg(int... i)
  2. average(int[] pixels)