public static int findMaxSum(int matrix[][]) {
		int rows = matrix.length;
		int max = 0;
		
		if (rows > 0) {
			int cols = matrix[0].length;
			if (cols > 0) {

				// i, j will determine the size of the submatrix
				for (int i = rows; i > 0; i--) {
					for (int j = cols; j > 0; j--) {
						// x, y will determine the top left of the submatrix
						for (int x = 0; x <= rows - i; x++) {
							for (int y = 0; y <= cols - j; y++) {
								int sum = 0;
								for (int a = x; a < x + i; a++) {
									for (int b = y; b < y + j; b++) {
										sum += matrix[a][b];
									}
								}
								max = sum > max ? sum : max;
							}
						}
					}
				}
			}
		}
		
		
		return max;
	}