Java Hex Calculate toHex(final byte b)

Here you can find the source of toHex(final byte b)

Description

Converts a byte to hexadecimal

License

LGPL

Parameter

Parameter Description
b - The byte to convert

Return

String with hexadecimal representation of the byte

Declaration

public static String toHex(final byte b) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*ww  w.  j a  v a2s.  co  m*/
     * Converts a byte to hexadecimal
     * 
     * @param b
     *            - The byte to convert
     * @return String with hexadecimal representation of the byte
     */
    public static String toHex(final byte b) {
        return String.format("%02X", b);
    }
}

Related

  1. toHex(byte[] val)
  2. toHex(byte[] val, int start, int len)
  3. toHex(byte[] value)
  4. toHex(byte[] value)
  5. toHex(char c)
  6. toHex(final byte b)
  7. toHex(final byte... bin)
  8. toHex(final byte[] ba)
  9. toHex(final byte[] ba)