Java Byte to Hex String byteToHexString(final byte b)

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

Description

Converts the given byte to a (zero-padded, if necessary) hex String .

License

Apache License

Declaration

private static String byteToHexString(final byte b) 

Method Source Code

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

public class Main {
    /** Converts the given byte to a (zero-padded, if necessary) hex {@link String}. */
    private static String byteToHexString(final byte b) {
        final String s = Integer.toHexString(b & 0xff);

        return (s.length() == 1) ? "0" + s : s;
    }/*from  w w w.j a  v  a 2  s  .com*/
}

Related

  1. byteToHexString(byte[] b)
  2. byteToHexString(byte[] bytes)
  3. byteToHexString(byte[] bytes, int start, int end)
  4. byteToHexString(byte[] bytes, int start, int end)
  5. byteToHexString(byte[] data)
  6. byteToHexString(final byte b)
  7. byteToHexString(final byte inbyte)
  8. byteToHexString(int b)
  9. byteToHexString(int nib1, int nib2)