Maybe you could try to use the dimensions of the array inthe loop, if that is the problem?
public int[][] grid(int rSize, int cSize)
{
array = new int[rSize][cSize];
for(row = 0; row < rSize; row++)
{
for(col = 0; col < cSize; col++)
{
array[row][col] = 0;
}
}
return array;
}
But, since an integer array will be initialized with zero values anyway, and since the method is only creating and returning the array, it would be simpler and quicker to get rid of the method.
Assuming you are using the method this way:
int[][] myArray = grid(3, 3);
you could get rid of the method and simply write
int[][] myArray = new int[3][3];
Technically there would only be an interest for the method if you would want it to assign specific initial values; which is not the case here.
Hope this helps.