Java Array Sum sum(short tab[], int a, int b)

Here you can find the source of sum(short tab[], int a, int b)

Description

sum

License

Open Source License

Declaration

static public int sum(short tab[], int a, int b) 

Method Source Code

//package com.java2s;
//  it under the terms of the GNU General Public License as published by      //

public class Main {
    static public int sum(short tab[], int a, int b) {
        int sum = 0;
        for (int i = a; i <= b; i++) {
            sum += tab[i];//w  w  w.ja v a 2  s .c  o  m
        }
        return sum;
    }

    static public float sum(float tab[], int a, int b) {
        float sum = 0;
        for (int i = a; i <= b; i++) {
            sum += tab[i];
        }
        return sum;
    }
}

Related

  1. sum(long[] counts)
  2. sum(Number... numbers)
  3. sum(Number[] array)
  4. sum(Number[] numbers)
  5. sum(Object[] srcOne, Object[] srcTwo)
  6. sum(short[] ary)
  7. sum(String[] tokens, int start, int length, String separator)
  8. sum3(double[] a, double[] b)
  9. sum_configurations(int[] elements, int sum)