Java Byte Array to String byteToString(byte[] bByte)

Here you can find the source of byteToString(byte[] bByte)

Description

byte To String

License

Apache License

Declaration

private static String byteToString(byte[] bByte) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /** global array **/
    private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
            'E', 'F' };

    private static String byteToString(byte[] bByte) {
        int k = 0;
        int len = bByte.length;
        char[] myChar = new char[len * 2];
        for (byte b : bByte) {
            myChar[k++] = HEX_DIGITS[b >>> 4 & 0x0f];
            myChar[k++] = HEX_DIGITS[b & 0x0f];
        }//from  ww w  .  ja va 2s. c  o  m
        return new String(myChar);
    }
}

Related

  1. byteToStr(byte[] byteArray)
  2. byteToStr(byte[] byteArray)
  3. ByteToString(byte[] a, int nLen)
  4. byteToString(byte[] array, int byteLength)
  5. byteToString(byte[] b)
  6. byteToString(byte[] bByte)
  7. byteToString(byte[] byteArr)
  8. byteToString(byte[] bytearray)
  9. byteToString(byte[] bytes)