2

I want to translate the following c# code into java code, but i cannot find the equivalent of copyTo of Java BitSet

public byte [] translate(BitArray mask)
    {
        byte[] tmp = new byte[(mask.Length + 7) >> 3];
        mask.CopyTo(tmp, 0);
        return tmp;
    }

1 Answer 1

1

In Java, you wouldn't even need to write your own method to do that - you could just call BitSet#toByteArray. I.e., in your case, just use mask.toByteArray().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.