Java Byte to Hex String byteToHexString(byte b)

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

Description

byte To Hex String

License

Open Source License

Declaration

private static String byteToHexString(byte b) 

Method Source Code

//package com.java2s;

public class Main {
    private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C",
            "D", "E", "F" };

    private static String byteToHexString(byte b) {
        int n = b;
        if (n < 0)
            n = 256 + n;/*  w  ww.ja  v a2s . c o  m*/
        int d1 = n / 16;
        int d2 = n % 16;
        return hexDigits[d1] + hexDigits[d2];
    }
}

Related

  1. byteToHexString(byte b)
  2. byteToHexString(byte b)
  3. byteToHexString(byte b)
  4. byteToHexString(byte b)
  5. byteToHexString(byte b)
  6. byteToHexString(byte b)
  7. byteToHexString(byte bytes[])
  8. byteToHexString(byte data)
  9. byteToHexString(byte data)