Added the Java Code