Java functionality

Addressed a bug in the python version (API unchanged)
and created a new java class with command line support