Java Hex Calculate toHex(int num)

Here you can find the source of toHex(int num)

Description

to Hex

License

Open Source License

Declaration

public static String toHex(int num) 

Method Source Code

//package com.java2s;

public class Main {
    public static String toHex(int num) {
        num = num & 0xff;/* ww  w  . j  ava  2s  .c om*/
        final String hex = Integer.toHexString(num);
        return hex.length() == 1 ? "0" + hex : hex;
    }
}

Related

  1. toHex(int n)
  2. toHex(int n, Boolean bigEndian)
  3. toHex(int n, int bytes)
  4. toHex(int n, int s)
  5. toHex(int nibble)
  6. toHex(int nybble)
  7. toHex(int r, int g, int b)
  8. toHex(int r, int g, int b)
  9. toHex(int r, int g, int b)