Reworking in java