Modified Java code.