- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert integer to octal
To convert integer to octal in Java, use the Integer.toOctalString() method.
Let’s say the following is our integer.
int val = 768;
Convert the above integer to octal.
Integer.toOctalString(val)
The following is the final example.
Example
public class Demo { public static void main(String[] args) { int val = 768; // integer System.out.println("Integer: "+val); // octal System.out.println("Octal String = " + Integer.toOctalString(val)); } }
Output
Integer: 768 Octal String = 1400
- Related Articles
- Java Program to convert decimal integer to octal number
- Convert decimal integer to octal in Java
- Java Program to convert Decimal to Octal
- JAVA Program to Convert Binary to Octal
- JAVA Program to Convert Octal to Binary
- JAVA Program to Convert Octal to Hexadecimal
- Java Program to convert int to Octal String
- Java program to convert decimal number to octal value
- Java program to convert float decimal to Octal number
- Java Program to convert octal number to decimal number
- Java Program to convert integer to boolean
- Java Program to convert boolean to integer
- Java Program to convert integer to hexadecimal
- Golang Program to convert Decimal to Octal
- Swift Program to convert Decimal to Octal

Advertisements