Convert integer to binary java

Hey guys!! Welcome to flower brackets blog. Today we are going to learn convert integer to binary java.

convert integer to binary java

Here we are going to learn binary conversion java using Integer.toBinaryString().

Also read – binary to decimal java

import java.util.*;

public class IntToBinaryDemo
{
   public static void main(String[] args)
   {
      Integer num = new Integer(23);
      String strBinary = Integer.toBinaryString(num);
      System.out.println("Binary conversion : " + strBinary);
   }
}

Output:

Binary conversion : 10111

Related Posts