updated java doc
some code optimizations
code optimizations