sum array with offset index - Java Collection Framework

Java examples for Collection Framework:Array Algorithm

Description

sum array with offset index

Demo Code


//package com.java2s;

public class Main {
    public static double sum(double[] input, int offset, int len) {
        double sum = 0;
        for (int i = offset; i < offset + len; i++) {
            sum += input[i];/*from   w  ww  .j  a  v  a 2s . co  m*/
        }
        return sum;
    }
}

Related Tutorials