i have checked the values for variables and they all seem to be correct. The method getMatrix is defined in another class but I'm still having having problems. I've tried going through the for loops myself and can't see anything wrong with them. Can you understand why?
[ EJFH Edited formatting] [ March 10, 2004: Message edited by: Ernest Friedman-Hill ]
I've reformatted your code so that the indentation shows the structure. It looks like you're editing code in some sort of editor that doesn't do this for you automatically -- you really should consider using a better editor or IDE; a real programmer's editor is a huge help. An automated formatter can instantly show you problems (like the problem here!) with your code. In any case, with the indentation above, it's easy to see that the small loops over "i" and "all" near the bottom of the page are actually inside the large loops over "i" and "all" that start near the top of the routine. In all the time I've been programming and teaching, I've never actually seen anyone make this particular error, so congratulations The inner loops are making changes to the loop counters being used by the outer loops. Therefore, depending on the values of the various constants, the outer loops will be executed either fewer or more times than you'd expect. Since you're saying it never gets to the bottom of the routine, I suspect that row1 is less than theRowCount, so that the variable "all" never gets large enough to finish that large inner for loop! Anyway, I have no idea what the logic of this routine is supposed to be, but hopefully you'll be able to sort it out.