corrected some javadoc and simplified java calls

I didn't tested the memory footprint for this change, but it could be more.
Should I revert this change for secure?