Added some useful java snippets.