Android Byte Array to Hex Convert getBinaryStrFromByteArr(byte[] bArr)

Here you can find the source of getBinaryStrFromByteArr(byte[] bArr)

Description

get Binary Str From Byte Arr

License

Open Source License

Declaration

public static String getBinaryStrFromByteArr(byte[] bArr) 

Method Source Code

//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;
    }
}

Related

  1. toHexString(byte[] data)
  2. toHexString(byte[] data, int offset, int length)
  3. toHexStringArray(byte[] data, int offset, int length)
  4. convertToHexString(byte[] input)
  5. dumpHex(byte[] bytes)
  6. toHex(byte[] buf)
  7. toHex(byte[] buf)
  8. byte2hex(byte[] b)
  9. byte2hex(byte[] b)