This example will explain how to convert int to hexadecimal number with toHexString method of Integer wrapper class.
Source Code
package com.beginner.examples;
public class GetHexadecimal {
public static void main(String[] args) {
int n1 = 60;
// Use the toHexString() method in the Integer class to get the
// hexadecimal number
String strHex = Integer.toHexString(n1);
System.out.println(n1+" ---> "+strHex);
}
}
Output:
60 ---> 3c