Java program to print decimal to octal conversion

Java program to print decimal to octal conversion. In a Java program, convert decimal to octal. Decimals are one of the types of numbers since a decimal point distinguishes the whole number from the fractional variable. The octal numeral system, also known as oct, is a base-8 numbering system that employs the digits 0 through 7. By grouping consecutive binary digits into groups of three, octal numerals can be generated from binary numerals.

public class Main
{ 
public static void main(String args[])
{ 
System.out.println(Integer.toOctalString(15)); 
}
} 

 

Output

17

What is octal number in java

The octal numeral system, sometimes known as oct, is a base-8 numbering system that uses the numerals 0 through 7. By arranging consecutive binary digits into groups of three, octal numerals can be created from binary numerals.

Using octal to abbreviate binary numbers is a convenient technique to do so. Begin by grouping all binary digits into groups of three, starting on the right.

What is decimal number in java

A decimal number is defined as a number with a decimal point separating the full number and fractional parts. The digits after the decimal point represent a value less than one.

The tenths place is represented by the first digit following the decimal. The hundredths place is represented by the following digit after the decimal. The remaining digits fill in the place values until there are no more digits to put in.