Java Code (1.7)