Convert decimal integer to binary number example : Binary « Data Type « Java






Convert decimal integer to binary number example

  

public class Main {
  public static void main(String[] args) {
    int i = 78;

    String strBinaryNumber = Integer.toBinaryString(i);
    System.out.println(strBinaryNumber);
  }
}
//1001110

   
    
  








Related examples in the same category

1.Convert Decimal to Binary
2.Convert from decimal to binary
3.Parsing and Formatting a Number into Binary
4.to Bit String
5.This class allows a number to be easily formatted as a binary number.