Here you can find the source of toBitString(int i)
public static String toBitString(int i)
//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(); } }