Java Bit String From toBitString(int i)

Here you can find the source of toBitString(int i)

Description

to Bit String

License

Open Source License

Declaration

public static String toBitString(int i) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toBitString(int i) {
        StringBuilder bitString = new StringBuilder();

        do {//w w w.ja  v a  2  s  . c o  m
            bitString.append(String.valueOf(i % 2));
        } while ((i /= 2) > 0);

        return bitString.reverse().toString();
    }
}

Related

  1. toBitString(final byte n)
  2. toBitString(final byte[] b)
  3. toBitString(final byte[] b)
  4. toBitString(final double d)
  5. toBitString(final StringBuilder sb, final byte value, final int count2)
  6. toBitString(int meta)
  7. toBitString(long i)