Java Code