Java Utililty Methods Bits to String

List of utility methods to do Bits to String

Description

The list of methods to do Bits to String are organized into topic(s).

Method

StringbitsToString(boolean[] pBits)
Converts a boolean[] to a String of 0's and 1's.
String vString = "";
for (int i = 0; i < pBits.length; i++) {
    vString += (pBits[i] ? "1" : "0");
return vString;
StringbitsToString(final int i)
bits To String
StringBuilder rValue = new StringBuilder(32);
for (int j = 0; j < 32; ++j) {
    if ((i & (1 << (31 - j))) == 0) {
        rValue.append("0");
    } else {
        rValue.append("1");
return rValue.toString();