This is where a debugger (or println statements) comes in very handy so one can step through the logic (as does posting a short compilable code snipped as you have). I'm not fully sure about the...