Java-Integer to Binary Octal Hexadecimal

Integer to Binary Octal Hexadecimal

The toBinaryString() method produces a string containing a binary representation of the value of type int that is passed as the argument to the method.

The toHexString() method produces a string containing a hexadecimal representation of the value of type int that is passed as the argument to the method.

The toOctalString() method produces a string containing a octal representation of the value of type int that is passed as the argument to the method.

Program

0

Program Source

public class Javaapp {
  
    public static void main(String[] args) {
        
        System.out.println("100 in Binary      : "+Integer.toBinaryString(100));
        System.out.println("100 in Hexadecimal : "+Integer.toHexString(100));
        System.out.println("100 in Octal       : "+Integer.toOctalString(100));
    }
}

Leave a Comment