75
Java Convert Octal to Decimal
We can convert octal to decimal in java using Integer.parseInt() method or custom logic.
Java Octal to Decimal conversion: Integer.parseInt()
The Integer.parseInt() method converts a string to an int with the given radix. If you pass 8 as a radix, it converts an octal string into decimal. Let us see the signature of parseInt() method:
Let’s see the simple example of converting octal to decimal in java.
Output:
81
Let’s see another example of Integer.parseInt() method.
Output:
81 19 8
Java Octal to Decimal conversion: Custom Logic
We can convert octal to decimal in java using custom logic.
Output:
Decimal of 121 is: 81 Decimal of 23: 19 Decimal of 10 is: 8
References
Next TopicJava Decimal to Octal