Skip to content
Advertisement

Tag: bit

How to flip all the bits in Java BitSet while preserving its length

How can I flip all the bits in a Java BitSet, while preserving its length? For example, given the following BitSet: Is there a simple method to flip all the bits, while preserving the BitSet length (6, in the above example)? I would like to get: Answer BitSet has a flip(from, to) method, which allows you to flip bits in

Byte to “Bit”array

A byte is the smallest numeric datatype java offers but yesterday I came in contact with bytestreams for the first time and at the beginning of every package a marker byte is send which gives further instructions on how to handle the package. Every bit of the byte has a specific meaning so I am in need to entangle the

Advertisement