This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.

I'm currently trying to solve a problem that is on project Euler (projecteuler.net) that deals with finding the largest palindrome made from the product of two 3-digit numbers. I think the code I have written works, but the problem I'm running into is:
Exception in thread "main" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
I'm exceeding the memory limit. I was just wondering if this was because im using Integers.

Here's my code:
Class 1:

Class 2:

Anything anyone can think of would be helpful. Thanks.

"If the facts don't fit the theory, get new facts" --Albert Einstein

No, it's because you are trying to create an array which is way too big for your computer's memory. Instead of doing this, you could take this comment:

and work on that. Hint: what's the largest possible product of two three-digit numbers?

Or better still you could produce a solution which doesn't require an array at all.

The largest possible product of two 3-digit numbers would be:

999 * 999 = 998001

I'm not really sure how i'd implement this without an array or some similar data structure, because don't i need to store all the palindromes i find so i can get the largest one??

1) have a variable BiggestPalin = 0;
2) use the same iteration that you have used to create the array.
3) for each iteration, calculate the product, check if its a palindrome.
4) if the product is a palindrome, check if its greater than BiggestPalin, If yes, update BiggestPalin.
5) Print the value finally.

This would not need an array or other data Structures.