Java Utililty Methods Bit Unset

List of utility methods to do Bit Unset

Description

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

Method

voidunset(byte[] bytes)
Unset an array of bytes.
for (int i = 0; i < bytes.length; i++) {
    bytes[i] = 0;
intunsetb(int num, int bitmask)
unsetb
if (bset(num, bitmask))
    num -= bitmask;
return num;
voidUnsetBit(byte _bitset, byte bit)
Unset Bit
_bitset &= Byte.valueOf(bit);
byteunsetBit(byte b, int pos)
unset Bit
return (byte) (b & ~(1 << pos));
byteunsetBit(byte original, int bitToUnSet)
Sets a bit to zero in a byte then returns new byte
return (byte) (original & ~(1 << bitToUnSet));
byte[]unsetBit(byte[] b, int index)
Sets the bit at the specified index of b to 0.
int maxIndex = b.length * 8 - 1;
if ((index < 0) || (index > maxIndex)) {
    throw new IndexOutOfBoundsException(
            "Invalid bit index: " + index + " for " + b.length + "-byte array.");
int byteOffset = b.length - (index / 8) - 1;
int bitOffset = index % 8;
byte mask = (byte) ~(0xFF & (1 << bitOffset));
...
intunsetBit(int f, int i)
unset Bit
int k = (1 << i);
if (f % (2 * k) >= k) {
    return f - k;
return f;
intunSetBit(int integer, int bit)
un Set Bit
return (integer & ~(1 << bit));
intunsetBit(int value, int flags)
Unset bits for value using 'bitwise and' operation and return modified value.
return value &= flags;
longunsetBit(long flags, long bit)
Unset a bit or bit combination from bitmap
return flags & ~bit;