Java code compiling now

Changed test cases so that java code passes with all test cases.