understanding of a recursive method

Hi, I'm trying to write a method that checks if the sum of the first row in a multi dimensional array is equal to the sum, in at least one row of in the array.

Ex. {1,1,1}{3}{4,3,2} should return true.

Ex. {1,1,1}{2}{2,4} should return false.

For some reason I'm not getting different results.

Here is my code:

Code:

`public class Q1{`

public static boolean what (int [] [] a){

return what ( a,0,0,0,0);

}

private static boolean what (int [] [] a,int f, int c, int i, int j){

if (i == a.length-1 && c!=f)

return false;

if (c == f && i==a.length-1)

return true;

if (i==0){

if (j<a[0].length)

what(a,f+=a[0][j],c,i,j+1);

what(a,f,c,i+1,0);

}

if (i<a.length){

if (j<a[i].length)

what(a,f,c+=a[i][j],i,j+1);

}

return what(a,f,0,i+1,0);

}

}

Thank you.

Thanks Gary for taking a look

The style is important indeed usually I organize it, maybe it's the agony and frustration of this topic that make me think less about it and more of how to solve it..:)

I forgot to mention I'm not intending to keep you busy with my homework, basically I'm trying still to grasp this recursion subject so some methods work for me and some doesn't, now this one doesn't.

The problems I'm coming across are mostly in boolean recursions.

I could write simple methods but in this one I don't know what went wrong.

So basically I need some help reinforcing my understanding of this kind of methods.

Thanks.