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.