Here you can find the source of toBinary(byte b)
public static String toBinary(byte b)
//package com.java2s; //License from project: Apache License public class Main { public static String toBinary(byte b) { return String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0'); }/*from w w w. j a v a 2 s.c om*/ }