Adding the Java Code