Here you can find the source of getBinaryStrFromByte(byte b)
public static String getBinaryStrFromByte(byte b)
//package com.java2s; public class Main { public static String getBinaryStrFromByte(byte b) { String result = ""; byte a = b; for (int i = 0; i < 8; i++) { result = (a % 2) + result;//from w w w . j a v a 2s . c o m a = (byte) (a >> 1); } return result; } }