Java Utililty Methods Bit Value Set

List of utility methods to do Bit Value Set

Description

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

Method

Stringbit_marker(String attribute, String type, int maxBits, int bit, boolean on)
bimarker
if (bit >= maxBits)
    throw new RuntimeException("bit is greater than maxbits");
StringBuilder result = new StringBuilder(attribute.length() + maxBits + type.length() + 2);
StringBuilder bitmarks = new StringBuilder(maxBits + 1);
result.append(attribute).append('_').append(type).append('_');
for (int i = 0; i < maxBits; i++) {
    bitmarks.append('x');
bitmarks.setCharAt(maxBits - bit - 1, on ? '1' : '0');
return result.append(bitmarks).toString();
Stringbit_marker_flexint(String attribute, int bit, boolean on)
bimarkeflexint
return bit_marker(attribute, FLEXINT_TYPE, FLEXINT_MAXBITS, bit, on);
Stringbit_marker_geohash(String attribute, int bit, boolean on)
bimarkegeohash
return bit_marker(attribute, GEOHASH_TYPE, GEOHASH_MAXBITS, bit, on);
booleanbitIsSet(byte data, byte bit)
bit Is Set
return getBitValue(data, bit) != 0;
booleanbitIsSet(int i, int offset)
bit Is Set
return (i & (1 << offset)) != 0;
booleanbitIsSet(int x, int pos)
Determines whether a particular bit is set in the binary representation of an integer.
return (x & (1 << pos)) != 0;
booleanbitIsSet(long value, long test)
Checks if bits are set in a value.
return (value & test) == test;
bytebitSet(byte b, int pos)
bit Set
return (byte) (b | (1 << pos));
booleanbitSet(int value, int bitmask)
bit Set
return (value & bitmask) > 0;
longbitSet(long holder, int i, boolean set)
bit Set
if (i < 0 || i > 63) {
    throw new IllegalArgumentException("i should from 0 inclusive and 64 exclusive");
if (set) {
    return holder | (1 << i);
} else {
    int ii = 1 << i;
    return (holder | ii) ^ ii;
...