How to Convert Octal to Decimal Number in Java


In this example we will show how to convert octal number to decimal number with valueOf method of Integer wrapper class.

Source Code

package com.beginner.examples;

public class Oct2DecExample {

    public static void main(String[] args){
    	 String octNum = "13";
		 //Octal number converted to decimal number
		 int decNum = Integer.parseInt(octNum , 8);
		 System.out.println("Decimal number is : " + decNum);
    }
}

Output:

Decimal number is : 11
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments