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