Android Byte Array to Hex Convert byte2hex(byte[] b)

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

Description

bytehex

Declaration

public static String byte2hex(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {

    public static String byte2hex(byte[] b) {
        StringBuffer sb = new StringBuffer(b.length * 2);
        String tmp = "";
        for (int n = 0; n < b.length; n++) {
            tmp = (java.lang.Integer.toHexString(b[n] & 0XFF));
            if (tmp.length() == 1) {
                sb.append("0");
            }/*  w ww .j av a  2  s  .com*/
            sb.append(tmp);
        }
        return sb.toString().toUpperCase(); 
    }
}

Related

  1. convertToHexString(byte[] input)
  2. dumpHex(byte[] bytes)
  3. getBinaryStrFromByteArr(byte[] bArr)
  4. toHex(byte[] buf)
  5. toHex(byte[] buf)
  6. byte2hex(byte[] b)
  7. hexEncode(byte[] data)
  8. encodeHex(byte[] data)
  9. decodeHex(char[] data)