Java tutorial
//package com.java2s; public class Main { private static String byte2bits(byte ch) { int z = ch; z |= 256; String str = Integer.toBinaryString(z); int len = str.length(); return str.substring(len - 8, len); } }