The version of java code passed 8 testcases