updated java snippets