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 set the bit position. This method returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set. Syntax: public BigInteger setBit(int n) Parameter: n- Index of the bit to set entered by...
2 min read
Java BigInteger Method The method of Java BigInteger class is used to find the Bitwise XOR of two BigIntegers. This method returns a BigInteger whose value is (this ^ val). Syntax: public BigInteger xor(BigInteger val) Parameter: val - value to be XOR'ed with this BigInteger. Returns: This method returns this...
2 min read
Java BigInteger method The method of Java BigInteger class is used to get the greatest common divisor of absolute values of two BigInteger. This method returns a BigInteger whose value is the greatest common divisor of abs (this) and abs (val). Greatest Common Divisor: The greatest...
2 min read
Java BigInteger testBit() Method The testBit() method of Java BigInteger class is used to check whether the designated bit is set or not. This method returns true if and only if the designated bit is set. This method computes (this & (1<<n)) != 0). Syntax: public boolean testBit(int...
1 min read
Java BigInteger method The method of Java BigInteger class is used to convert this BigInteger to a double.This conversion is similar to the narrowing primitive conversion from double to float. Narrowing Primitive Conversion: According to The Java Language Specification, It is defined as ifthisBigInteger has too...
1 min read
Java BigInteger method The method of Java BigInteger class is used to find a probably prime number of any bit length. This method returns a positive BigInteger that is probably prime, with the specified bitLength. Syntax: public static BigInteger probablePrime(int bitLength,Random rnd) Parameter: bitLength- bitLength of the...
3 min read
Java BigInteger method The method of Java BigInteger class is used to convert the numeric value of this BigInteger object to its equivalent string representation in a given radix or base. Syntax: public String public String toString(int radix) Parameter: radix - radix of the String representation. Returns: This method returns...
3 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
Java BigInteger Method The method of Java BigInteger class is used to find the Bitwise OR of two BigIntegers. This method returns a BigInteger whose value is (this | val). Syntax: public BigInteger or(BigInteger val) Parameter: val - value to be OR'ed with this BigInteger. Returns: This method returns (this...
2 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
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