posted 17 years ago
But this display can't come from the code snippet above; the getValue() method, as shown, will always return the same value (mem[0]).
So I don't think we're looking at the code you're actually running.
But now that I see what toString() is supposed to do here, I can see several problems with it. For example, it looks like each row is supposed to show 16 contigous elements with a tab after the first 8. But you're actually skipping an element in the middle of each row; the upper limit of the left half is "< j+8", while the lower limit of the right if "= j+9". The element at index j+8 is skipped. Similarly, although you're printing 16 items in each row, you're incrementing j by 17 each time, so that if you fix the above, the item at the end of each row will be skipped.
In any case, if you fix both of these, you'll see that element at the beginning of the second row wrap back around to be at the end of the first row, which I gather is what you want.
[ September 25, 2006: Message edited by: Ernest Friedman-Hill ]