Adding Java code snippet