Added java docs to the program as required.