Java Bits to String bitsToString(final int i)

Here you can find the source of bitsToString(final int i)

Description

bits To String

License

LGPL

Declaration

public static String bitsToString(final int i) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static String bitsToString(final int i) {
        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");
            }// www .  j  a v  a  2 s.com
        }
        return rValue.toString();
    }
}

Related

  1. bitsToString(boolean[] pBits)