add problem 1 Java code