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

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

Description

byte To String

License

Open Source License

Declaration

private static String byteToString(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private final static String[] strDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C",
            "D", "E", "F" };

    private static String byteToString(byte[] b) {
        StringBuffer strBuffer = new StringBuffer();
        for (int i = 0; i < b.length; i++) {
            strBuffer.append(strDigits[(b[i] & 0xf0) >>> 4]);
            strBuffer.append(strDigits[b[i] & 0x0f]);
        }/*www . j a  v  a 2  s.co m*/
        return strBuffer.toString();
    }
}

Related

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