Parse and format a number to octal in Java
Description
The following code shows how to parse and format a number to octal.
Example
/*from ww w .ja v a 2s. c o m*/
public class Main {
public static void main(String[] argv) throws Exception {
int i = Integer.parseInt("1000", 8);
String s = Integer.toString(i, 8);
System.out.println(s);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »