Added the complete code to Test.java