Java Hex Calculate toHexString(final byte hex)

Here you can find the source of toHexString(final byte hex)

Description

to Hex String

License

Open Source License

Declaration

public static String toHexString(final byte hex) 

Method Source Code

//package com.java2s;

public class Main {
    public static String toHexString(final byte hex) {
        return "0x" + Integer.toHexString(hex & 0x000000FF);
    }//from   w w  w  .  j  a  v  a 2s .com

    public static String toHexString(final short hex) {
        return "0x" + Integer.toHexString(hex & 0x0000FFFF);
    }

    public static String toHexString(final int hex) {
        return "0x" + Integer.toHexString(hex);
    }

    public static String toHexString(final long hex) {
        return "0x" + Long.toHexString(hex);
    }
}

Related

  1. toHexString(byte[] value)
  2. toHexString(byte[] value, int startOffset, int maxLength, boolean uppercase, char separator)
  3. toHexString(char c)
  4. toHexString(final byte b)
  5. toHexString(final byte b)
  6. toHexString(final byte value)
  7. toHexString(final byte[] arr)
  8. toHexString(final byte[] array)
  9. toHexString(final byte[] b)