List of usage examples for java.math BigInteger BigInteger
private BigInteger(long val)
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("1234"); BigInteger bi2 = new BigInteger("-1234"); System.out.println(bi1.toString()); System.out.println(bi2.toString()); }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("16"); BigInteger bi2 = new BigInteger("-16"); System.out.println(bi1.toString(8)); System.out.println(bi2.toString(2)); }
From source file:BigNumApp.java
public static void main(String args[]) { BigInteger n = new BigInteger("1000000000000"); BigInteger one = new BigInteger("1"); while (!n.isProbablePrime(7)) n = n.add(one);/*from w ww . j a v a 2s . c o m*/ System.out.println(n.toString(10) + " is probably prime."); System.out.println("It is " + n.bitLength() + " bits in length."); }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("20"); // assign nextProbablePrime value of bi1 to bi2 BigInteger bi2 = bi1.nextProbablePrime(); System.out.println(bi2);//from ww w . j av a2 s .c om }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("20"); // assign negate value of bi1 to bi2 BigInteger bi2 = bi1.negate(); System.out.println(bi2);/* ww w .j a v a 2 s . co m*/ }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("7"); // perform setbit operation on bi1 using index 3 BigInteger bi2 = bi1.setBit(3); System.out.println(bi2);//from w ww . j a va 2s . co m }
From source file:Main.java
public static void main(String[] argv) throws Exception { BigInteger bi = new BigInteger("1183728"); }
From source file:Main.java
public static void main(String[] args) { BigInteger bi = new BigInteger("10"); Boolean b1 = bi.testBit(2);//from w ww. jav a2 s . co m Boolean b2 = bi.testBit(3); // print b1, b2 values System.out.println(b1); System.out.println(b2); }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("-100"); BigInteger bi2 = new BigInteger("3"); // perform mod operation on bi1 using bi2 BigInteger bi3 = bi1.mod(bi2); System.out.println(bi3);//from w ww . j ava2s . c o m }
From source file:Main.java
public static void main(String[] args) { BigInteger bi1 = new BigInteger("-100"); BigInteger bi2 = new BigInteger("3"); // divide bi1 with bi2 BigInteger bi3 = bi1.divide(bi2); System.out.println(bi3);/* ww w . j a v a 2s .c om*/ }