added Java code