Apparently, there is a bug in the Sun JDK 1.4.2 or lower implementation of java.lang.String. This bug has been identified as 4310930, 4546734, 4637640, 4724129 in Sun's Bug Database. I've come across this bug while reading Charles Miller's post, when he was having trouble with the OutOfMemoryError in his JDBC code.
Please download this source code to see what I'm talking about. Try to run the source code, and continue until you reach the OutOfMemoryError state, as seen in my own trial here. Then, change the source code to the working alternatives, and test them out (see my result here).
This bug has been fixed in JDK 5.0 release, but I believe most of us are still working with Sun JDK 1.4.2 or lower. So I guess this is a problem that we must be very careful with.
A friend of mine send me a link to the Petals around the Rose Puzzle. It's essentially a simulation of rolling 5 dice at the same time, then guess what is the number of Petals around the Rose. It's quite fun actually to guess them. I've had 16 tries (approx. 15 mins) before finding my solution to the problem. The solution has been proven within the next 30 successfull tries.
Try them out for yourself, and let me know how you did it.
Here's my solution in Spanish: (use Google Translator to translate them into English)
No haga caso de todo, a excepción de 5 y de 3. Cada 5 cuentas para 4 pétalos. Cada 3 cuentas para 2 pétalos. Resuma el número de pétalos.
Another friend of mine come up with a smarter (more visual) solution, also within 10-15 minutes time. Here's his solution in Spanish:
La rosa es el punto en el centro de el corto en cubos. Solamente 1/3/5 tiene ese punto. Por lo tanto, 2/4/6 no es se levantó. El pétalo es los otros puntos que rodean color de rosa. Así, solamente 3/5 rosa tiene 2/4 de los pétalos.
Let me know your solution.. :D
It's just a fun way to start the day.. :D