Here you can find the source of byteToBits(byte b)
public static String byteToBits(byte b)
//package com.java2s; //License from project: Open Source License public class Main { public static String byteToBits(byte b) { return "" + (byte) ((b >> 7) & 0x1) + (byte) ((b >> 6) & 0x1) + (byte) ((b >> 5) & 0x1) + (byte) ((b >> 4) & 0x1) + (byte) ((b >> 3) & 0x1) + (byte) ((b >> 2) & 0x1) + (byte) ((b >> 1) & 0x1) + (byte) ((b >> 0) & 0x1); }//from w w w. j av a 2s. c o m }