67
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.
Output:
a f 121
Java Decimal to Hex conversion: Custom Logic
We can convert decimal to hex in java using custom logic.
Output:
Hexadecimal of 10 is: A Hexadecimal of 15 is: F Hexadecimal of 289 is: 121
Next TopicJava Octal to Decimal