Here you can find the source of sum(int[] values, int begin, int end)
public static int sum(int[] values, int begin, int end)
//package com.java2s; public class Main { public static int sum(int[] values, int begin, int end) { int s = 0; for (int i = begin; i < end; i++) { s += values[i];/*from www . jav a 2 s . c o m*/ } return s; } public static int sum(int[] values) { return sum(values, 0, values.length); } public static int sum(int[][] values) { int s = 0; for (int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { s += values[i][j]; } } return s; } }