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

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

Description

hex Encode

Declaration

public static String hexEncode(byte[] data) 

Method Source Code

//package com.java2s;

public class Main {
    private static final char[] HEXCHARS = "0123456789abcdef".toCharArray();

    public static String hexEncode(byte[] data) {
        StringBuffer r = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            byte v = data[i];
            r.append(HEXCHARS[(v >> 4) & 0xf]).append(HEXCHARS[v & 0xf]);
        }// w  ww  .  j a v a 2s  . c  o m
        return r.toString();
    }
}

Related

  1. getBinaryStrFromByteArr(byte[] bArr)
  2. toHex(byte[] buf)
  3. toHex(byte[] buf)
  4. byte2hex(byte[] b)
  5. byte2hex(byte[] b)
  6. encodeHex(byte[] data)
  7. decodeHex(char[] data)
  8. bytesToHex(byte[] data)
  9. bytesToHexString(byte[] bytesArray)