List of utility methods to do Bit Set
int | setBit(int f, int i) set and unset a bit in an integer int k = (1 << i); if (f % (2 * k) < k) { return f + k; return f; |
int | setBit(int flag, int i) set Bit return flag | pow2(i);
|
int | setBit(int flags, int bit) Set a bit or bit combination on bitmap return flags | bit;
|
int | setBit(int i, int bit, boolean enabled) Sets/unsets a bit in the given integer. if (enabled) i |= bit; else i &= ~bit; return i; |
int | setBit(int i, int bit, boolean state) set Bit int mask = 1 << bit; if (state) { i |= mask; } else { i &= ~mask; return i; |
int | setBit(int integer, int bit) set Bit return (integer | (1 << bit));
|
int | setBit(int mask, int bit, boolean value) set Bit mask |= (value ? 1 : 0) << bit;
return mask;
|
int | setBit(int n, int bitPosition) Sets bit position in a copy of the integer and returns it int number = n; int bitNumber = 1 << (bitPosition - 1); return (number | bitNumber); |
int | setBit(int position, boolean value, int meta) set Bit if (value) { return meta | (1 << position); return meta & ~(1 << position); |
void | setBit(int position, byte[] array) Sets the bit in the array. if (position < 0 || position >= array.length * 8) { throw new IllegalArgumentException("Position is invalid"); array[position / 8] |= (128 >> (position % 8)); |