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

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

Description

byte Hex String

Declaration

public static String byte2HexString(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {

    public static String byte2HexString(byte[] b) {
        StringBuffer sb = new StringBuffer();
        int length = b.length;
        for (int i = 0; i < b.length; i++) {
            String stmp = Integer.toHexString(b[i] & 0xff);
            if (stmp.length() == 1)
                sb.append("0" + stmp);
            else/*from  w w  w .j a  v a 2s.com*/
                sb.append(stmp);
        }
        return sb.toString();
    }
}

Related

  1. bytesToHexString(byte[] bytes)
  2. bytesToHexString(byte[] bytes)
  3. bytesToHexString(byte[] bytes)
  4. byte2HexStr(byte[] b)
  5. byte2HexStr(byte[] b, int length)
  6. byte2Hext(byte bin)
  7. byteArr2HexStr(byte[] arr)
  8. byteArr2HexStr(byte[] arrB)
  9. byteArr2HexStr(byte[] paramArrayOfByte)