Edit- This post was in response to Tjstretch offering a spoonfed solution that didn't actually solve the problem (he then claimed he was going to ignore complaints about spoonfeeding). This is one of my main gripes with spoonfeeding- most of the people who do it, don't read the entire thread, so what they post is usually misleading or flat out wrong. Even if a spoonfed answer is right (which is rare), it's still not helpful.
I'll keep this here for posterity:
Wow. You can ignore this all you want, but I highly recommend you read this:
http://www.javaprogrammingforums.com...n-feeding.html
The reason I recommend this, is that's NOT what I meant (it was one solution I hinted at, but it's certainly not the best). It doesn't actually help with the algorithm, and it certainly doesn't answer the OP's core question. Why wouldn't you just use an Integer? Notice that I did suggest that, and notice that it's not what I was arguing can't be taught by spoonfeeding. I don't really see the point of your post.
Actually, I don't think I even consider that spoonfeeding, as it pretty much has nothing to do with the actual problem. It's a (small) piece of the problem, and I actually don't even think it's a good way to go. But it doesn't matter, because it doesn't actually have anything to do with the actual question!
And THAT, my friends, is the problem with spoonfeeders.