Convert decimal integer to octal number example - Java Language Basics

Java examples for Language Basics:int

Description

Convert decimal integer to octal number example

Demo Code

 
public class Main {
 
        public static void main(String[] args) {
               //from  ww w  . ja v  a2  s  . c  o  m
                int i = 27;
               
                String strOctalNumber = Integer.toOctalString(i);
               
                System.out.println("Convert decimal number to octal number example");
                System.out.println("Octal value of " + i + " is " + strOctalNumber);
                                                                       
        }
}

Result


Related Tutorials