1import java.util.Scanner;
2public class OctalToBinaryJava
3{
4 public static void main(String[] args)
5 {
6 Scanner sc = new Scanner(System.in);
7 System.out.println("Please enter octal number: ");
8 int octal = Integer.parseInt(sc.nextLine(), 8);
9 String strBinary = Integer.toBinaryString(octal);
10 System.out.println("Binary value is: " + strBinary);
11 sc.close();
12 }
13}
1public class OctalToDecimalDemo
2{
3 public static void main(String[] args)
4 {
5 String strOctal = "141";
6 // converting octal to decimal number using Integer.parseInt() method
7 int decimal = Integer.parseInt(strOctal, 8);
8 System.out.println(decimal);
9 }
10}