I am writing a program, in Java, which need bit processing, and manipulations. But I could not find any "bit" level primitive datatype. Is there any way in Java to define "bit" datatype? In C/C++, we can tell compiler how many bits to allocate for variables storage as
struct bit {
unsigned int value : 1; // 1 bit to store value
};
How can I do same thing in Java?
boolean
or Boolean
with true
or false
(or Boolean.TRUE
/ Boolean.FALSE
). Both of which can be used with autoboxing and unboxing. There is also a BitSet
for handling a vector of bits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With