there are a few things concerning your code snippet:
previousrow should be null in your case. To fix it simply do
double previousrow = new double[10];
Note that ROWCOUNT is not available at the time of compilation and that you cannot use it here for instantiation. A better solution would be to use an ArrayList (see here).
Next you should also instantiate n. A better way would be to use the ROWINDEX as this is the index of the currently processed row (starting at 0).