Java Utililty Methods Bit Clean

List of utility methods to do Bit Clean

Description

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

Method

byteclearBit(byte b, int i)
clear Bit
return (byte) logicalAND(b, logicalNOT(bitMask(i)));
byteclearBit(byte input, int bit)
clear Bit
return (byte) (input & ~BYTE[bit]);
byteclearBit(byte v, int position)
Returns v, with the bit at position set to zero.
return (byte) clearBit((int) v, position);
intclearBit(int bits, int index)
Sets bit at index in bits to zero.
return bits & ~(1 << index);
intclearBit(int flag, int i)
clear Bit
int bit = pow2(i);
return (flag & bit) == 0 ? flag : flag ^ bit;
intclearBit(int n, int bitPosition)
Clears bit position in a copy of the integer and returns it
int number = n;
int bitNumber = ~(1 << (bitPosition - 1));
return (number & bitNumber);
intclearBit(int value, int bit)
Clear the bit within the int.
assert bit >= 0 && bit < 16;
return value & ~bitMask(bit);
intclearBit(int value, int bit)
Clears the specified bit from the value
return value & ~bit;
intclearBit(int value, int bitIndex)
clear Bit
assert (bitIndex >= 0);
assert (bitIndex <= 31);
int bit = pow2(bitIndex);
return (value & bit) == 0 ? value : value ^ bit;
intclearBit(int value, int index)
Clears a bit of a value at a given position.
return value & (value ^ (1 << index));