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) {
        String hs = "";
        String stmp = "";
        for (int n = 0; n < b.length; n++) {
            stmp = Integer.toHexString(b[n] & 0XFF);
            if (stmp.length() == 1)
                hs = hs + "0" + stmp;
            else/*from w w w. j a  v  a2 s. c  o m*/
                hs = hs + stmp;
        }
        return hs.toUpperCase();
    }
}

Related

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