Convert decimal integer to octal number in Java
Description
The following code shows how to convert decimal integer to octal number.
Example
//from ww w .j av a 2s .co m
public class Main {
public static void main(String[] args) {
int i = 27;
String strOctalNumber = Integer.toOctalString(i);
System.out.println(strOctalNumber);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »