Java test code for interviews