all the java code optmised snippets