How to set/unset a bit at specific position of a long in Java ?
For example,
long l = 0b001100L ; // bit representation
I want to s
Please see the class java.util.BitSet that do the job for you.
To set : myByte.set(bit); To reset : myByte.clear(bit); To fill with a bool : myByte.set(bit, b); To get the bool : b = myByte.get(bit);
myByte.set(bit);
myByte.clear(bit);
myByte.set(bit, b);
b = myByte.get(bit);