Here you can find the source of sumValues(double[] vector)
Parameter | Description |
---|---|
vector | a parameter |
public static double sumValues(double[] vector)
//package com.java2s; public class Main { /**// w w w . j a va 2 s. com * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static double sumValues(double[] vector) { double sum = 0; for (double v : vector) sum += v; return sum; } /** * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static float sumValues(float[] vector) { float sum = 0; for (float v : vector) sum += v; return sum; } /** * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static int sumValues(int[] vector) { int sum = 0; for (int v : vector) sum += v; return sum; } /** * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static int sumValues(byte[] vector) { int sum = 0; for (int v : vector) sum += v; return sum; } /** * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static int sumValues(short[] vector) { int sum = 0; for (int v : vector) sum += v; return sum; } /** * Compute the sum of values in an array * @param vector * @return the sum of all values */ public static long sumValues(long[] vector) { long sum = 0; for (long v : vector) sum += v; return sum; } }