Java Convert Decimal to Hexadecimal

We can convert decimal to hexadecimal in java using Integer.toHexString() method or custom logic.

Java Decimal to Hex conversion: Integer.toHexString()

The Integer.toHexString() method converts decimal to hexadecimal. The signature of toHexString() method is given below:

Let's see the simple example of converting decimal to binary in java.

Test it Now

Output:

a
f
121

Java Decimal to Hex conversion: Custom Logic

We can convert decimal to hex in java using custom logic.

Test it Now

Output:

Hexadecimal of 10 is: A
Hexadecimal of 15 is: F
Hexadecimal of 289 is: 121




Contact US

Email:[email protected]

Decimal to Hex
10/30