 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert octal number to decimal number
Use the parseInt() method with the second parameter as 8 since it is the radix value. The parseInt() method has the following two forms.
static int parseInt(String s) static int parseInt(String s, int radix)
To convert octal to decimal, use the 2nd syntax and add radix as 8, since octal radix is 8.
Integer.parseInt("25", 8) The following is an example.
Example
public class Demo {    public static void main( String args[] ) {       // converting to decimal       System.out.println(Integer.parseInt("25", 8));    } }  Output
21
Advertisements
 