Does BigDecimal support bit manipulation? If yes, can someone please point to a good tutorial on this?
If no, what is the best method to divide a BigDecimal variable by powers of 2?
I think you mean BigInteger here. BigDecimal uses a decimal representation for floating point values, so it is not suited for bit manipulation.
BigInteger does have left and right shift operations with .shiftLeft() and .shiftRight() for multiplications/divisions by powers of two respectively, so you can use that.
It also has operations such as .bitCount(), .bitLength(), .{clear,set}Bit(), .and(), .or(), .andNot() and a few others. No bitwise not, though, since it does not make sense.
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