updated java code