This may already be there but the FAQ/Wiki and associated resources seem to be AWOL at moment.
Relating to Code
Do not post "pseudo code" if you are having a problem or error with your code. It has as little value as posting no code at all and is possibly worse because it can fool people trying to help you into thinking they might be able to actually diagnose the problem from what you posted.
There is I am sure a better way to phrase this but these kinds of questions are rather hopeless
Help I have Null pointer exception when I run this code
On a related note please do not use SMS in your code. S.o.p is NOT System.out.println If you copied and pasted your actual source then you are only adding keystrokes to turn System.out into s.o
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus