Convert Decimal Number to Octal String using Java

Integer.toOctalString method

package app;

public class Main
{
    public static void main(String[] args)
    {
        int decimalNumber = 40;
        String octalString = Integer.toOctalString(decimalNumber);

        System.out.println(octalString);
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.