Java Utililty Methods Bits to String

List of utility methods to do Bits to String

  1. HOME
  2. Java
  3. B
  4. Bits to String

Description

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

Method

String bitsToString(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;
String bitsToString(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();

AltStyle によって変換されたページ (->オリジナル) /