List of usage examples for java.math BigInteger BigInteger
private BigInteger(long val)
From source file:Main.java
public static void main(String[] args) { // assign value to bi1 BigInteger bi1 = new BigInteger("8");// 1000 // perform flipbit operation on bi1 with index 1 BigInteger bi2 = bi1.flipBit(1); System.out.println(bi2);/* w w w. j av a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { BigDecimal bg1 = new BigDecimal(new BigInteger("40")); }
From source file:Main.java
public static void main(String[] args) { BigDecimal bg1 = new BigDecimal(new BigInteger("40"), 2); }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("18"); BigInteger bi2 = new BigInteger("24"); // assign gcd of bi1, bi2 to bi3 BigInteger bi3 = bi1.gcd(bi2); System.out.println(bi3);// w ww .j a va2 s . com }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("6"); // 110 BigInteger bi2 = new BigInteger("3"); // 011 // perform and operation on bi1 using bi2 BigInteger bi3 = bi1.and(bi2); System.out.println(bi3);//from ww w . jav a 2 s. c o m }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("6"); // 110 BigInteger bi2 = new BigInteger("3"); // 011 // perform andNot operation on bi1 using bi2 BigInteger bi3 = bi1.andNot(bi2); System.out.println(bi3);/*from ww w .jav a 2s. c om*/ }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("123"); BigInteger bi2 = new BigInteger("50"); // perform add operation on bi1 using bi2 BigInteger bi3 = bi1.add(bi2); System.out.println(bi3);/*from ww w . j av a 2s . com*/ }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("6"); BigInteger bi2 = new BigInteger("8"); // perform or operation on bi1, bi2 BigInteger bi3 = bi1.or(bi2); System.out.println(bi3);// w w w.j a v a 2 s . co m }
From source file:Main.java
public static void main(String[] args) { // assign value to bi1 BigInteger bi1 = new BigInteger("123"); // assign a larger value to bi2 BigInteger bi2 = new BigInteger("12345678"); // assign double value of bi1, bi2 to d1, d2 Double d1 = bi1.doubleValue(); Double d2 = bi2.doubleValue(); System.out.println(d1);/*from w w w. ja v a 2 s . c o m*/ System.out.println(d2); }
From source file:Main.java
public static void main(String[] args) { // assign values to bi1, bi2 BigInteger bi1 = new BigInteger("12345"); BigInteger bi2 = new BigInteger("987654321"); // assign the hashcode of bi1, bi2 to i1, i2 int i1 = bi1.hashCode(); int i2 = bi2.hashCode(); System.out.println(i1);// w w w. j av a 2 s . c o m System.out.println(i2); }