Convert from decimal to binary : Binary « Data Type « Java






Convert from decimal to binary

  
public class Main {
  public static void main(String[] args) throws Exception {

    int i = 42;
    String bin = Integer.toBinaryString(i);
    System.out.println(bin);
  }
}
//101010

   
    
  








Related examples in the same category

1.Convert Decimal to Binary
2.Convert decimal integer to binary number example
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.