- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert octal number to decimal number in Java
To convert octal to decimal number, use the Integer.parseInt() method with radix 8. Here, the radix is for Octal i.e. 8.
Let’s say we have the following octal string.
String myOctal = "25";
To convert it to decimal, use the Integer.parseInt() method.
int val = Integer.parseInt(myOctal, 8);
The following is the complete example.
Example
public class Demo { public static void main(String []args) { String myOctal = "25"; System.out.println("Octal = "+myOctal); int val = Integer.parseInt(myOctal, 8); System.out.println("Decimal = "+val); } }
Output
Octal = 25 Decimal = 21
- Related Articles
- Java Program to convert octal number to decimal number
- Java program to convert decimal number to octal value
- Java program to convert float decimal to Octal number
- Java Program to convert decimal integer to octal number
- C# program to convert decimal to Octal number
- Python program to convert float decimal to octal number
- Convert decimal integer to octal in Java
- C++ Program to convert Octal Number to Decimal and vice-versa
- How to Convert Decimal Number to Binary/Octal/Hex Number or Vice Versa in Excel?
- Java Program to convert Decimal to Octal
- Java program to convert decimal number to hexadecimal number
- Java Program to convert binary number to decimal number
- Java Program to convert hexadecimal number to decimal number
- C++ Program to Convert Octal Number to Binary Number
- Convert decimal integer to hexadecimal number in Java

Advertisements