Cumulative Sum double array - Java java.lang

Java examples for java.lang:double Array

Description

Cumulative Sum double array

Demo Code


//package com.java2s;

public class Main {
    public static double CumulativeSum(double[] data) {
        double Sum = 0;
        for (int i = 0; i < data.length; i++) {
            Sum = add(Sum, data[i]);/*from  w  ww. ja  v a 2 s.  c om*/
        }
        return Sum;
    }

    public static double add(double first, double second) {
        return first + second;
    }
}

Related Tutorials