Best code examples for Java 8 BigInteger class (java.math.BigInteger)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BigInteger class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 BigInteger examples from Open Source projects
This code example shows how to use the following methods: intValue, toByteArray
38:	BigInteger bi = new BigInteger("1"); 
39:	assert bi.intValue() == 1; 
-
41:	assert IntegerType.instance.fromString(IntegerType.instance.getString(ByteBuffer.wrap(bi.toByteArray()))) 
42:	.equals(ByteBuffer.wrap(bi.toByteArray())); 
43:	assert IntegerType.instance.compose(ByteBuffer.wrap(bi.toByteArray())).equals(bi); 
44:	assert IntegerSerializer.instance.toString(bi).equals("1"); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: add, subtract
218:	assertInvalid(testee, new ModelNode().set(BigInteger.valueOf(Integer.MAX_VALUE).add(BigInteger.ONE))); 
219:	assertInvalid(testee, new ModelNode().set(BigInteger.valueOf(Integer.MIN_VALUE).subtract(BigInteger.ONE))); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
129:	integerType = new BigInteger(source); 
-
136:	return decompose(integerType); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: bitLength, mod
50:	int e = (n.bitLength() + 1) / 2; 
-
67:	BigInteger s = d1U.getD().multiply(Q2UBar).mod(n).add(d2U.getD()).mod(n); 
-
73:	BigInteger hs = parameters.getH().multiply(s).mod(n); 
-
77:	Q1V.getQ(), Q2VBar.multiply(hs).mod(n), Q2V.getQ(), hs); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: compareTo, modInverse
67:	k = new BigInteger(qBitLength, random); 
-
69:	while (k.compareTo(params.getQ()) >= 0); 
-
71:	BigInteger  r = params.getG().modPow(k, params.getP()).mod(params.getQ()); 
-
73:	k = k.modInverse(params.getQ()).multiply( 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: toString
27:	BigInteger integer = new BigInteger(sud,16); 
-
29:	System.out.println("bi ="+integer.toString() ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
38:	BigInteger bi = new BigInteger(md5).abs(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: equals
54:	doTestHMACDetDSASample("SHA224withDETDSA", privKey, new BigInteger("4BC3B686AEA70145856814A6F1BB53346F02101E", 16), new BigInteger("410697B92295D994D21EDD2F4ADA85566F6F94C1", 16)); 
-
121:	if (!r.equals(ASN1Integer.getInstance(seq.getObjectAt(0)).getValue())) 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, subtract, toByteArray
This code example shows how to use the following methods: bitLength, longValue
87:	BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); 
88:	if (bi.bitLength() > 64) 
-
90:	return bi.longValue(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, divide, gcd, hashCode, multiply
38:	BigInteger aNumber1 = new BigInteger(value1); 
-
40:	int code1 = aNumber1.hashCode(); 
41:	aNumber1.add(aNumber2).shiftLeft(125); 
42:	aNumber1.subtract(aNumber2).shiftRight(125); 
43:	aNumber1.multiply(aNumber2).toByteArray(); 
44:	aNumber1.divide(aNumber2).bitLength(); 
45:	aNumber1.gcd(aNumber2).pow(7); 
46:	int code2 = aNumber1.hashCode(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: divide, multiply, pow
17:	BigInteger mine = new BigInteger(""+2); 
18:	BigInteger pow = mine.pow(127); 
19:	BigInteger div = pow.divide(new BigInteger(numNodes+"")); 
20:	return ""+div.multiply(new BigInteger(i+"")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: bitLength, subtract
43:	int minBits = Math.min(256, N.bitLength() / 2); 
-
45:	BigInteger max = N.subtract(ONE); 
-
47:	return BigIntegers.createRandomInRange(min, max, random); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, intValue, longValue
209:	BigInteger value = new BigInteger( text, radix ); 
-
214:	return Integer.valueOf( value.intValue() ); 
-
216:	return new Long( value.longValue() ); 
-
222:	if( value.compareTo(MAX_INTEGER) <= 0 && value.compareTo(MIN_INTEGER) >= 0 ) 
-
224:	return Integer.valueOf(value.intValue()); 
-
226:	else if( value.compareTo(MAX_LONG) <= 0 && value.compareTo(MIN_LONG) >= 0 ) 
-
228:	return new Long(value.longValue()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: toString
27:	BigInteger integer = new BigInteger(sud,16); 
-
29:	System.out.println("bi ="+integer.toString() ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, subtract
331:	assertToNumberOverflow(BigInteger.valueOf(Integer.MAX_VALUE).add(BigInteger.ONE), Integer.class); 
332:	assertToNumberOverflow(BigInteger.valueOf(Integer.MIN_VALUE).subtract(BigInteger.ONE), Integer.class); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, divide, gcd, hashCode, multiply
38:	BigInteger aNumber1 = new BigInteger(value1); 
-
40:	int code1 = aNumber1.hashCode(); 
41:	aNumber1.add(aNumber2).shiftLeft(125); 
42:	aNumber1.subtract(aNumber2).shiftRight(125); 
43:	aNumber1.multiply(aNumber2).toByteArray(); 
44:	aNumber1.divide(aNumber2).bitLength(); 
45:	aNumber1.gcd(aNumber2).pow(7); 
46:	int code2 = aNumber1.hashCode(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, intValue, longValue
131:	if(bi.compareTo(INTEGER_MAX) <= 0 && bi.compareTo(INTEGER_MIN) >= 0) 
-
134:	return new Integer(bi.intValue()); 
-
136:	if(bi.compareTo(LONG_MAX) <= 0 && bi.compareTo(LONG_MIN) >= 0) 
-
139:	return new Long(bi.longValue()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
20:	return new BigInteger(value); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: multiply
33:	private static Logger LOG = LoggerFactory.getLogger(TokenAwareConnectionPoolTest.class); 
-
117:	BigInteger threeNodeRingIncrement = new BigInteger("600"); 
-
121:	Operation<TestClient, String> thirdHostOp    = new TokenTestOperation(threeNodeRingIncrement.multiply(new BigInteger("2"))); 
122:	Operation<TestClient, String> maxTokenHostOp = new TokenTestOperation(threeNodeRingIncrement.multiply(new BigInteger("3"))); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, mod, multiply
188:	h = h.multiply(qInv); 
189:	h = h.mod(p);               // mod (in Java) returns the positive residual 
-
192:	m = h.multiply(q); 
193:	m = m.add(mQ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
66:	newDoc.field("integer", new BigInteger("10")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: subtract
37:	BigInteger max = p.subtract(TWO); 
-
44:	return BigIntegers.createRandomInRange(min, max, random); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: toByteArray
26:	byte[] bytes = s.toByteArray(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: hashCode
226:	hashCode ^= publicExponent.hashCode(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: toString
88:	assert i.toString(2).indexOf("1") > -1; 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: mod, modPow, subtract
80:	if ( publicKey_B.mod(fConstants.largePrime_N).equals(BigInteger.ZERO) ) 
-
85:	BigInteger		SRP6_u = SRPUtils.calc_u(fPublicKey_A, publicKey_B); 
-
93:	BigInteger		B_minus_g_pow_x = publicKey_B.subtract(three_g_pow_x); 
-
95:	fCommonValue_S = B_minus_g_pow_x.modPow(fRandom_a.add(ux), fConstants.largePrime_N).mod(fConstants.largePrime_N); 
96:	fEvidenceValue_M1 = SRPUtils.calcM1(fPublicKey_A, publicKey_B, fCommonValue_S); 
-
103:	{ setServerPublicKey_B(new BigInteger(v)); } 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, mod, multiply, toByteArray
140:	h = h.multiply(qInv); 
141:	h = h.mod(p);               // mod (in Java) returns the positive residual 
-
144:	m = h.multiply(q); 
145:	m = m.add(mQ); 
-
147:	output = m.toByteArray(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: equals, subtract
6:	: ack(m.subtract(BigInteger.ONE), 
-
8:	} 
9:	 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isProbablePrime, toString
5:	BigInteger n = new BigInteger(args[0]); 
-
7:	System.out.println(n.toString() + " is " + (n.isProbablePrime(certainty) ? "probably prime" : "composite")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, modInverse, multiply, signum
355:	s = new BigInteger(bytes); 
-
365:	if (r.signum() != 1 || r.compareTo(q) != -1 || s.signum() != 1 
366:	|| s.compareTo(q) != -1) { 
-
370:	w = s.modInverse(q); 
-
372:	u1 = (new BigInteger(1, digest)).multiply(w).mod(q); 
373:	u2 = r.multiply(w).mod(q); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
31:	return new BigInteger(bytes); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, subtract
45:	if (startToken.compareTo(endToken) < 0) { 
46:	return endToken.subtract(startToken); 
-
49:	return endToken.add(MAXIMUM).subtract(startToken); 
-
54:	return tokenDifference(new BigInteger(startToken), new BigInteger(endToken)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, compareTo, equals, intValue, pow
215:	checkRoundingUnnecessary(sqrtFloor.pow(2).equals(x)); // fall through 
-
221:	int sqrtFloorInt = sqrtFloor.intValue(); 
222:	boolean sqrtFloorIsExact = 
-
225:	return sqrtFloorIsExact ? sqrtFloor : sqrtFloor.add(BigInteger.ONE); 
-
229:	BigInteger halfSquare = sqrtFloor.pow(2).add(sqrtFloor); 
-
235:	return (halfSquare.compareTo(x) >= 0) ? sqrtFloor : sqrtFloor.add(BigInteger.ONE); 
-
274:	BigInteger sqrt1 = sqrt0.add(x.divide(sqrt0)).shiftRight(1); 
275:	if (sqrt0.equals(sqrt1)) { 
-
280:	sqrt1 = sqrt0.add(x.divide(sqrt0)).shiftRight(1); 
281:	} while (sqrt1.compareTo(sqrt0) < 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: intValue, toByteArray
43:	BigInteger bi = new BigInteger("1"); 
44:	assert bi.intValue() == 1; 
-
46:	assert IntegerType.instance.fromString(IntegerType.instance.getString(ByteBuffer.wrap(bi.toByteArray()))) 
47:	.equals(ByteBuffer.wrap(bi.toByteArray())); 
48:	assert IntegerType.instance.compose(ByteBuffer.wrap(bi.toByteArray())).equals(bi); 
49:	assert JdbcInteger.instance.toString(bi).equals("1"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: multiply
90:	b = b.multiply(new BigInteger(""+factor)); 
91:	return super.format(b, arg1, arg2); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: add, toByteArray
30:	return new BigInteger(bytes); 
-
38:	return ByteBuffer.wrap(obj.toByteArray()); 
-
61:	bigint = bigint.add(new BigInteger("1")); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: abs, bitLength, getLowestSetBit, shiftRight
93:	BigInteger absX = x.abs(); 
94:	int exponent = absX.bitLength() - 1; 
-
111:	long twiceSignifFloor = absX.shiftRight(shift).longValue(); 
-
121:	&& ((signifFloor & 1) != 0 || absX.getLowestSetBit() < shift); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: divide
91:	b = b.divide(new BigInteger(""+factor)); 
92:	return super.format(b, arg1, arg2); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: compareTo, modInverse, signum, subtract
29:	this.p = new MPInteger(in); 
-
52:	int cmp = p.compareTo(q); 
-
68:	this.u = new MPInteger(p.modInverse(q)); 
-
70:	expP = d.remainder(p.subtract(BigInteger.valueOf(1))); 
71:	expQ = d.remainder(q.subtract(BigInteger.valueOf(1))); 
72:	crt = q.modInverse(p); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: subtract
54:	return BigIntegers.createRandomInRange(ONE, q.subtract(ONE), random); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
54:	new BigInteger(1, new byte[] {(byte)0x92,(byte)0x39,(byte)0xd5,(byte)0x34,(byte)0x8f,(byte)0x40,(byte)0xd1,(byte)0x69,(byte)0x5a,(byte)0x74,(byte)0x54,(byte)0x70,(byte)0xe1,(byte)0xf2,(byte)0x3f,(byte)0x43}), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
126:	return ecParams.getG().multiply(privKey).getEncoded(); 
-
234:	return new BigInteger(key.getOctets()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: hashCode
33:	return _txid.hashCode(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
39:	BigInteger a = new BigInteger(1, Hex.decode("ff12345678")); 
-
41:	byte[] a5 = BigIntegers.asUnsignedByteArray(5, a); 
-
46:	byte[] a6 = BigIntegers.asUnsignedByteArray(6, a); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: bitLength, subtract
43:	int minBits = Math.min(256, N.bitLength() / 2); 
-
45:	BigInteger max = N.subtract(ONE); 
-
47:	return BigIntegers.createRandomInRange(min, max, random); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: multiply, negate, subtract
17:	BigInteger a2 = TWO.multiply(a), b2 = TWO.multiply(b), c2 = TWO.multiply(c), 
-
20:	a2.subtract(b).add(c2), 
21:	a2.subtract(b2).add(c3)); 
-
26:	a2.negate().add(b).add(c2), 
27:	a2.negate().add(b2).add(c3)); 
Full Snippet Info
7
CodeRank
Related Java 8 BigInteger Questions & Answers:
See Code Examples for Java 8 BigInteger Methods: