Here you can find the source of bytes2Binary(byte[] bytes)
public static String bytes2Binary(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static String bytes2Binary(byte[] bytes) { StringBuffer sb = new StringBuffer(); for (byte b : bytes) { sb.append(Integer.toBinaryString(b)); }//from w w w .j av a 2s . com return sb.toString(); } }