Android Byte Array to Hex Convert byte2HexStr(byte[] b, int length)

Here you can find the source of byte2HexStr(byte[] b, int length)

Description

byte Hex Str

Declaration

public static String byte2HexStr(byte[] b, int length) 

Method Source Code

//package com.java2s;

public class Main {

    public static String byte2HexStr(byte[] b, int length) {
        String hs = "";
        String stmp = "";
        for (int n = 0; n < length; ++n) {
            stmp = Integer.toHexString(b[n] & 0xFF);
            if (stmp.length() == 1)
                hs = hs + "0" + stmp;
            else {
                hs = hs + stmp;/*w  w  w .  ja  v  a2 s  . com*/
            }
            hs = hs + ",";
        }
        return hs.toUpperCase();
    }
}

Related

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