updated java code

check port num