Added Java documentation to the code