Here you can find the source of byteToBitStr(byte b)
public static String byteToBitStr(byte b)
//package com.java2s; //License from project: Open Source License public class Main { public static String byteToBitStr(byte b) { String zero = "00000000"; String s = Integer.toBinaryString(b); return zero.substring(0, 8 - s.length()) + s; }/*from ww w . ja va 2 s . c o m*/ }