Mega Code Archive

 
Categories / Java Tutorial / Data Type
 

Parsing and Formatting a Big Integer into Binary

import java.math.BigInteger; public class Main {   public static void main(String[] argv) throws Exception {     BigInteger bi = new BigInteger("1023");     // Parse and format to binary     bi = new BigInteger("1111111111", 2);      String s = bi.toString(2);    } }