Answers for "convert binary to octal java using toOctal"

2

binary to octal in java

public class UsingtoOctalStringMethod
{
   public static void main(String[] args)
   {
      String strNumber = "100101";
      int binary = Integer.parseInt(strNumber, 2);
      String strOctal = Integer.toOctalString(binary);
      System.out.println("Octal value is: " + strOctal);
   }
}
Posted by: Guest on October-30-2020
0

binary to octal conversion java program

// conversion of binary to octal in java..
public class Main{
    public static void main(String args[]) throws Exception{
        String binary = "1100100";                // binary number.. 
        int decimal = Integer.parseInt(binary,2); // converting binary to decimal
        System.out.println(Integer.toOctalString(decimal)); // 144 <= octal output..  
    }
}
Posted by: Guest on May-12-2020

Code answers related to "convert binary to octal java using toOctal"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language