Here you can find the source of computeSumTable(Scanner in, short n)
public static int[][] computeSumTable(Scanner in, short n)
//package com.java2s; //License from project: Open Source License import java.util.Scanner; public class Main { public static int[][] computeSumTable(Scanner in, short n) { int[][] matrix = new int[n][n]; int xSum = 0; for (int x = 0; x < n; x++) { xSum += in.nextInt();/*from w w w .j av a 2 s . c o m*/ matrix[x][0] = xSum; } for (int y = 1; y < n; y++) { xSum = 0; for (int x = 0; x < n; x++) { xSum += in.nextInt(); matrix[x][y] = xSum; matrix[x][y] += matrix[x][y - 1]; } } return matrix; } }