Javatpoint Logo
Javatpoint Logo

Java Convert Decimal to Octal

We can convert decimal to octal in java using Integer.toOctalString() method or custom logic.

Java Decimal to Octal conversion: Integer.toOctalString()

The Integer.toOctalString() method converts decimal to octal string. The signature of toOctalString() method is given below:

Let's see the simple example of converting decimal to octal in java.

Test it Now

Output:

10
23
121

Java Decimal to Octal conversion: Custom Logic

We can convert decimal to octal in java using custom logic.

Test it Now

Output:

Decimal to octal of 8 is: 10
Decimal to octal of 19 is: 23
Decimal to octal of 81 is: 121

References

  1. Integer.toOctalString() JavaDoc
  2. Integer.toOctalString() Javatpoint
Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA