example:
byte: 50 binary: 0b110010 +--------+---+---+---+---+---+---+---+---+ | bits | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | +--------+---+---+---+---+---+---+---+---+ | bitset | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +--------+---+---+---+---+---+---+-------+ bitSet.toString(): {2, 3, 6}
if (bytes == null) { return null; BitSet bit = new BitSet(); int index = 0; for (byte aByte : bytes) { for (int j = 7; j >= 0; j--) { bit.set(index++, (aByte & (1 << j)) >>> j == 1); ...
if (bytes == null) { throw new IllegalArgumentException("bitMap must not be null"); BitSet bit = new BitSet(); int index = 0; for (int i = 0; i < bytes.length; i++) { for (int j = 7; j >= 0; j--) { bit.set(index++, (bytes[i] & (1 << j)) >>> j == 1); ...
BitSet result = new BitSet(); for (int i = string.length(); --i >= 0;) result.set(string.charAt(i)); return result;
return bitSetFrom(number, NBITS_LONG_REPRESENTATION);
final BitSet bitset = new BitSet(size); for (int index : indices) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException( String.format("Index %d out of range [0, %d]", index, size - 1)); if (bitset.get(index)) { throw new IllegalArgumentException(String.format("Duplicate index %d", index)); ...
BitSet pixels = new BitSet(pixelsString.length()); int index = 0; for (int i = 0; i < pixelsString.length(); i++) { char c = pixelsString.charAt(i); if (c == '\n') { continue; pixels.set(index, c != '0'); ...
final BitSet bitSet = new BitSet(); convert(lowerBits, 0, bitSet); convert(upperBits, Long.SIZE, bitSet); return bitSet;
BitSet bitSet = new BitSet(); int i = 0; for (byte b : inString.getBytes()) { if (b == '1') { bitSet.set(i); i += 1; return bitSet;
BitSet bitSet = new BitSet(); for (int index : indexes) { bitSet.set(index); return bitSet;
BitSet bits = new BitSet(8); for (int i = 0; i < 8; i++) { if ((bytes & (1 << i)) > 0) { bits.set(i); return bits;