This tutorial will help show us how to convert int to octal integer with toOctalString method of Integer wrapper class in Java.
Source Code
package com.beginner.examples;
public class GetOctal {
public static void main(String[] args) {
int n = 60;
// Use the toOctalString() method in the Integer class to get the octal
// number
String strOct = Integer.toOctalString(n);
System.out.println(n + "--Octal number:" + strOct);
}
}
Output:
60--Octal number:74