We can convert hexadecimal to decimal in java using Integer.parseInt() method or custom logic.
Java Hexadecimal to Decimal conversion: Integer.parseInt()
The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below:
public static int parseInt(String s,int redix)
Let's see the simple example of converting hexadecimal to decimal in java.
Output:
Let's see another example of Integer.parseInt() method.
Output:
Java Hexadecimal to Decimal conversion: Custom Logic
We can convert hexadecimal to decimal in java using custom logic.
Output: