array problem

hey guys, im new to the forum, but i read the rules already so i wanted to start getting help on this homework problem i have for the weekend. i have to determine output of a recursive array code as follows:

anyways, i looked at it and thought that what it does is see if the number is larger than its grid.length, or spot in the grid, the calculate method will return a value of zero. otherwise, the number would be incremented. this all occurs right here:

Figure out what myGrid.length is then figure out how arrays work so that you get what total += myGrid[count][i] and total += myGrid[i][count] does. Take a paper and a pencil and start substituting the values you won't be far from concluding what values you get. Once you start getting values you could deduce the logic (which is what the program does) by making a pattern out of the values. Make use of Java docs and your array knowledge which I am sure you might have been given before giving this assignment, yet if you require help with Java Arrays you can use the Array tutorial from java which can be found here.

the i is the index position in the array. So if i is 2 it is the third element in the array (since arrays start from the index 0). In a double dimensional array this is essentially the same meaning, say for example you have a 2 arrays where each array is itself an array of 4 elements, they together make up 8 elements.

Imagine that row 1 is the first array and row 2 is the second array (each of four elements)
Now which element does arr[0][2] point to ?
Remember again that arrays have the base index as 0, so [0] means the 1st element and [2] means the 3rd element. So this points to the 3rd element of the 1st array, so in effect it means that it points to the 3rd column in the 1st row which is 6.

I hope you get that. You can practice some more using this.

Also it is important to note that even though I mention array elements laid out in rows and columns here, they are actually not placed in the memory that way. We "visualize" the array this way since it is easy to understand them this way. Arrays are laid out in consecutive memory locations.