Java tutorial
//package com.java2s; //PduUtils is distributed under the terms of the Apache License version 2.0 public class Main { public static String byteToBits(byte b) { String bits = Integer.toBinaryString(b & 0xFF); while (bits.length() < 8) { bits = "0" + bits; } return bits; } }