Grating everyone

I've to write a program that know how two animals related to gather, the program should first read the number of cases from file , and then the size of two matrices. i did that.
and then should compare the first matrix with size 4 with the second one which had the size 6 . ( to compare two matrices we have know the start point = m2-m1/2 and the end point = m2-start point. and then count the number of ones in each row and col by different method :
public static int sumRow( int m[][],int startPoint,int ei, int A[])
public static int sumCol( int m[][],int startPoint,int ei, int B[])

my problem now is how i can write these two methods i have no ideas !
c'ause am still beginner in java , i want to know how i can know the sum of ones in each row and col and put the answer in the array a and b.

for more info : " and sorry of my weak English"

Input
The input data is stored in file “digital.in”. The first line of the input file contains a single integer t (1  t  10), the number of test cases, subsequent lines correspond to the t test cases.
For each test case, the first line contains the number of rows in the small trace person. The subsequent line(s) contains data to fill the cells of that person row by row. Then, a line that contains the number of rows of the larger or equal size trace person. The subsequent line(s) contains data to fill the cells of the person with larger or equal size trace row by row.
Output
The output should be stored in file “digital.out”. The output should contain one line for each test case (as shown in the sample output below) indicating the type of relationship between the two persons as follows: Mothers’ sides, Father’s sides, Both sides, or Not related

Sample Input
The following input file contains 2 test cases. The first test case corresponds to 4x4 and 6x6 traces of two persons, and the second test case corresponds to 2x2 and 4x4 traces of another couple of persons.

2
4
0 0 0 0
1 1 1 1
1 1 0 0
1 1 1 1
6
0 1 1 1 1 0
0 0 0 0 0 0
1 1 1 1 1 0
1 1 1 0 0 0
1 1 1 1 1 1
1 1 1 1 1 1
2
1 1
0 1

4
1 1 1 1
1 1 1 1
1 0 0 0
0 0 0 1

Sample Output
Case 1: Both sides
Case 2: Not related

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.