Octal to Decimal, Binary & Hexadecimal in JAVA programming

import java.util.Scanner;

public class OctaltoAll {

    public static void main(String[] args) {
        Scanner myScanner=new Scanner(System.in);
        System.out.print("Enter a octal number : ");
       
        String str=myScanner.nextLine();
       
        int num=Integer.parseInt(str,8);
        String decimal=Integer.toString(num);
        String binary=Integer.toBinaryString(num);
        String hexa=Integer.toHexString(num);
       
        System.out.println("Decimal value is : " +decimal);
        System.out.println("Binary value is : " +binary);
        System.out.println("Hexadeciaml value is : " +hexa);
    }

}
//Enter a octal number : 345
//Decimal value is : 229
//Binary value is : 11100101
//Hexadeciaml value is : e5

Share this

Related Posts

Previous
Next Post »

1 comments:

comments
Anonymous
March 31, 2022 at 12:33 PM delete

Octal To Decimal, Binary And Hexadecimal In Java Programming - Education Help >>>>> Download Now

>>>>> Download Full

Octal To Decimal, Binary And Hexadecimal In Java Programming - Education Help >>>>> Download LINK

>>>>> Download Now

Octal To Decimal, Binary And Hexadecimal In Java Programming - Education Help >>>>> Download Full

>>>>> Download LINK

Reply
avatar