Java Byte to Hex String byteToHexStr(byte b)

Here you can find the source of byteToHexStr(byte b)

Description

byte To Hex Str

License

Open Source License

Declaration

private static String byteToHexStr(byte b) 

Method Source Code

//package com.java2s;

public class Main {
    private static String byteToHexStr(byte b) {
        char[] digit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        char[] tempArr = new char[2];
        tempArr[0] = digit[(b >>> 4) & 0x0F];
        tempArr[1] = digit[b & 0x0F];
        return new String(tempArr);
    }/*from   w ww .j  a  va2s  .  c o  m*/
}

Related

  1. byteToHexStr(byte b)
  2. byteToHexStr(byte buf[])
  3. byteToHexStr(byte src, int len, int code)
  4. byteToHexstr(byte[] b, boolean space)