Java Convert Byte to Octal String

Tags: byte Octal

In this Java core tutorial we learn how to convert byte value into octal String in Java programming language.

How to convert byte to octal in Java

In Java, with a given byte value we can use the Integer.toOctalString(int i) static method to convert it to an octal String as the following example Java program.

public class ConvertByteToOctalExample {
    public static void main(String... args) {
        byte byteValue = 12;

        // Convert Byte to Octal String
        String octalString = Integer.toOctalString(byteValue);

        System.out.println("byte value: " + byteValue);
        System.out.println("Octal value: " + octalString);
The output as below.
byte value: 12
Octal value: 14

Happy Coding 😊

Java Convert Byte to Hexadecimal String

Java Convert Hexadecimal String to Byte

Java Convert Octal String to Byte

Java Convert Byte to BigDecimal

Java Convert Byte to BigInteger