modified the code java