How to convert octal from String Object to primitive int decimal number in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {

    public static void main(String[] args) {

        String sOctal = "31";

        int decimal = Integer.parseInt(sOctal, 8);
        System.out.println(decimal);
    }
}
   
/*
      
run:
      
25
  
*/

 



answered Nov 7, 2016 by avibootz
...