reverse binary in java