Understanding bitwise operations and their application in Java
问题 I think understand what they fundamentally do - operate on bits (flip, shift, invert, etc...). My issue is that I don't know when I'd ever need to use them, and I don't think I fully understand bits. I know that there are 8 bits in a byte and I know that bits are either a 0 or 1 . Now here is where I start to get confused... I believe data types define combinations of bits differently. So if I declare an int , 32 bits are set aside for numbers, if I declare a char, 8 bits are set aside and