Java Data Type Tutorial - Java Integer.toHexString(int i)








Syntax

Integer.toHexString(int i) has the following syntax.

public static String toHexString(int i)

Example

In the following code shows how to use Integer.toHexString(int i) method.

public class Main {
  public static void main(String[] args) {
    System.out.println(Integer.toHexString(0));
    System.out.println(Integer.toHexString(10));
    System.out.println(Integer.toHexString(11));
    System.out.println(Integer.toHexString(16));
    System.out.println(Integer.toHexString(17));
    System.out.println(Integer.toHexString(100));
    System.out.println(Integer.toHexString(1000));
  }//w w w .j a va2  s. c o m
}

The output: