List of utility methods to do Bit Value Set
String | bit_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(); |
String | bit_marker_flexint(String attribute, int bit, boolean on) bimarkeflexint return bit_marker(attribute, FLEXINT_TYPE, FLEXINT_MAXBITS, bit, on);
|
String | bit_marker_geohash(String attribute, int bit, boolean on) bimarkegeohash return bit_marker(attribute, GEOHASH_TYPE, GEOHASH_MAXBITS, bit, on);
|
boolean | bitIsSet(byte data, byte bit) bit Is Set return getBitValue(data, bit) != 0;
|
boolean | bitIsSet(int i, int offset) bit Is Set return (i & (1 << offset)) != 0;
|
boolean | bitIsSet(int x, int pos) Determines whether a particular bit is set in the binary representation of an integer. return (x & (1 << pos)) != 0;
|
boolean | bitIsSet(long value, long test) Checks if bits are set in a value. return (value & test) == test;
|
byte | bitSet(byte b, int pos) bit Set return (byte) (b | (1 << pos)); |
boolean | bitSet(int value, int bitmask) bit Set return (value & bitmask) > 0;
|
long | bitSet(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; ... |