List of utility methods to do BitSet to String
String | bitSet2String(BitSet b) bit representation of a BitSet suitable for dumps and debugging int len = b.size(); len = (len > 128) ? 128 : len; StringBuilder d = new StringBuilder(len); for (int i = 0; i < len; i++) d.append(b.get(i) ? '1' : '0'); return d.toString(); |
String | bitSet2String(final BitSet bs) bit Set String final StringBuffer sb = new StringBuffer(); for (int i = 0; i < bs.length(); ++i) { final char ch = bs.get(bs.length() - i) ? '1' : '0'; sb.append(ch); return sb.toString(); |
String | bitSetToString(BitSet bits, int length) Converts a BitSet to String String sbits = ""; for (int i = length - 1; i >= 0; i--) sbits += (bits.get(i) ? "1" : "0"); return sbits; |
String | bitsetToString(BitSet bitset, int width, int height) bitset To String StringBuilder builder = new StringBuilder(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { builder.append((bitset.get(y * width + x)) ? 1 : 0); if (y < height - 1) { builder.append("\n"); return builder.toString(); |
String | bitsetToString(BitSet bs) bitset To String StringBuilder sb = new StringBuilder(); int start = 0; int old = 0; for (int v = bs.nextSetBit(0); v >= 0; v = bs.nextSetBit(v + 1)) { if (start == 0) { sb.append(v); old = v; } else if (v - start > 1) { ... |