Java Utililty Methods Bit Mask

List of utility methods to do Bit Mask

Description

The list of methods to do Bit Mask are organized into topic(s).

Method

intbitMask(final int numberOfBits)
Returns a bit mask for the specified number of bits.
if (numberOfBits >= 32) {
    return -1;
return (numberOfBits == 0 ? 0 : powerOf(2, numberOfBits) - 1);
intbitMask(int bit)
Calculate a bitmask of the bit.
assert bit >= 0 && bit < 16;
return 1 << bit;
intbitMask(int bitSize)
bit Mask
return (0xFFFFFFFF >>> (SZ_INT - bitSize));
bytebitMask(int i)
bit Mask
return (byte) (1 << i);