Parsing and Formatting a Number into Binary : Binary « Data Type « Java






Parsing and Formatting a Number into Binary

  

public class Main {
  public static void main(String[] argv) throws Exception {
    int i = 1023;
 
    i = Integer.parseInt("1111111111", 2);
    String s = Integer.toString(i, 2); 
    System.out.println(s);
  }
}

   
    
  








Related examples in the same category

1.Convert Decimal to Binary
2.Convert from decimal to binary
3.Convert decimal integer to binary number example
4.to Bit String
5.This class allows a number to be easily formatted as a binary number.