code for Java