- 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 decimal number to octal value
The java.lang.Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.
The toOctalString() method of the Integer class returns a string representation of the integer argument as an unsigned integer in base 8.
Example
import java.util.Scanner; public class DecimalToOctal { public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.println("Enter a decimal number ::"); int decimal = sc.nextInt(); String result = Integer.toOctalString(decimal); System.out.println("Octal value of the given decimal number is ::"+result); } }
Output
Enter a decimal number :: 45 Octal value of the given decimal number is ::55
- Related Articles
- Java Program to convert octal number to decimal number
- Java program to convert float decimal to Octal number
- Java Program to convert decimal integer to octal number
- Java Program to convert Decimal to Octal
- Convert octal number to decimal number in Java
- C# program to convert decimal to Octal number
- Python program to convert float decimal to octal number
- Golang Program to convert Decimal to Octal
- Swift Program to convert Decimal to Octal
- Java program to convert decimal number to binary value
- Java program to convert binary number to decimal value
- C++ Program to convert Octal Number to Decimal and vice-versa
- Convert decimal integer to octal in Java
- C++ Program to convert Decimal Numbers to Octal
- How to Convert Decimal to Octal?

Advertisements