Java BigInteger shiftLeft() Method20 Mar 2025 | 2 min read The shiftLeft() method of Java BigInteger class is used to shift the bits to the left by n times (shift distance). This method returns a BigInteger whose value is (this<<n). This method Computes floor (this * 2n). Syntax:Parameter:n- shift distance, in bits Returns:This method returns (this<< n). Exception:NA Note: The shift distance n, may be negative, in which case this method performs a right shift.Example 1Output: Shift left operation on 5, 2 times gives 20 Example 2Output: Shift left operation on 5, -2 times gives 1 Example 3Output: Shift left operation on 1, 4 times gives 16 Next TopicJava BigInteger |
Java BigInteger method The method of Java BigInteger class is used to compute the hash code for this BigInteger. This method overrides hashCode in class Object. Syntax: public int Parameter: NA. Returns: This method returns the hash code for this BigInteger. Exception: NA Example 1 import java.math.BigInteger; public class BigIntegerHashCodeExample1{ public static void main(String[] args){ //...
1 min read
Java BigInteger method The method of Java BigInteger class returns a BigInteger whose value is equal to that of the specified long. Syntax: public static BigInteger valueOf(long val) Parameter: val - value of the BigInteger to return. Returns: This method returns a BigInteger with the specified value. Exception: NA Note: This static factory...
2 min read
Java BigInteger method Themethod of Java BigInteger class is used tosubtracttwo BigInteger values.This method performs subtraction of this BigInteger and the method argument.This method returns a BigInteger whose value is (this - val). Syntax: public BigInteger subtract(BigInteger val) Parameter: val - Avalue to be subtracted from this BigInteger entered...
1 min read
Java BigInteger Method The method of Java BigInteger class is used to add two BigInteger values. This method returns a BigInteger object whose value is (this+ val). Syntax: public BigInteger add(BigInteger val) Parameter: val - A value to be added to this BigInteger. Returns This method returns a BigInteger object...
1 min read
Java BigInteger Method The method of Java BigInteger classreturns a BigInteger which corresponds to the result of clearing a bit designated by the method argument n. Syntax: public BigInteger clearBit(int n) Parameter: n-index of bit to clear entered by user Returns: This method returns a bigInteger of value,(this &~(1<<n)). Throws: ArithmeticException -...
1 min read
Java BigInteger ProbablePrime() Method The ProbablePrime() method of Java BigInteger class is used to find the Prime Number greater than the current BigInteger. This method returns the first integer greater than this BigInteger that is probably prime. Syntax: public BigInteger ProbablePrime() Parameter: NA Returns: This method returns the first integer greater...
1 min read
Java BigInteger method The method of Java BigInteger class is used to perform modular exponentiation. This method returns a BigInteger whose value is (thisexponent mod parameter value). This method first calculates the pow() method then applies the mod() method. This method allows negative exponents. Syntax: public...
2 min read
Java BigInteger method The method of Java BigInteger class is used to calculate the power of BigInteger value. This method returns a BigInteger whose value is (thisexponent ). Syntax: public BigInteger pow(int exponent) Parameter: exponent- exponent to which this BigInteger is to be raised. Returns: This method returns (thisexponent...
1 min read
Java BigInteger method The method of Java BigInteger class is used to find the modulus of the inverse of this BigInteger value. This method returns a BigInteger whose value is inverse of this BigInteger mod parameter value. Syntax: public BigInteger modInverse(BigInteger m) Parameter: m- the modulus. Returns: The method...
1 min read
Java BigInteger method The methodof Java BigInteger class is used to compare this BigInteger with the specified Object for equality.This method overrides equals in class Object. Syntax: public boolean equals(Object x ) Parameter: x - Object to which this BigInteger is to be compared. Returns: This method returnstrue if and...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India