Android examples for java.lang:array calculation
computes the sum of all values of a passed double array
//package com.java2s; public class Main { /**/*w w w. j ava2 s . co m*/ * computes the sum of all values of a passed double array * @param _vals the double array to compute the sum from * @return the sum of the elements of the passed array */ public static double sum(double[] _vals) { double sum = 0; for (int i = 0; i < _vals.length; i++) { sum += _vals[i]; } return sum; } }