Here you can find the source of bitsString2(byte b)
public static String bitsString2(byte b)
//package com.java2s; //License from project: Open Source License public class Main { public static String bitsString2(byte b) { int i = 0; String s = ""; while (i <= 7) { s += (b & (1 << i)) == 0 ? "0" : "1"; i++;/*w w w. ja v a 2s . co m*/ } return s; } }