Android Byte Array to Hex Convert bytes2HexString(byte[] data)

Here you can find the source of bytes2HexString(byte[] data)

Description

bytes Hex String

Declaration

public static String bytes2HexString(byte[] data) 

Method Source Code

//package com.java2s;

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

    public static String bytes2HexString(byte[] data) {
        StringBuffer sb = new StringBuffer(32);
        for (byte b : data) {
            char low = DIGITS[b & 0x0F];
            char high = DIGITS[(b & 0xF0) >>> 4];
            sb.append(high);//  ww w.  ja v  a 2 s.  co  m
            sb.append(low);
        }
        return sb.toString();
    }
}

Related

  1. encodeHexStr(final byte[] bytes)
  2. byteArrayToHexString(byte[] b)
  3. getHexString(byte[] raw)
  4. byte2hex(byte[] b)
  5. bytes2HexString(byte[] data)
  6. toHexString(byte[] b)
  7. byteArrayToHexString(byte[] data)
  8. bytesToHexString(byte[] bArray)
  9. toHexadecimealString(byte[] data)