Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I noticed that when you assign the array element, you're not checking the array bounds. I recommend checking that x is less than the length of your array before assigning a value to an array element with index x. That should fix your problem.
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4 all those years ago...)