Doing online judge in java.