Java BigInteger clearBit() Method20 Mar 2025 | 1 min read The clearBit() method of Java BigInteger classreturns a BigInteger which corresponds to the result of clearing a bit designated by the method argument n. Syntax:Parameter:n-index of bit to clear entered by user Returns:This method returns a bigInteger of value,(this &~(1<<n)). Throws:ArithmeticException - if n is negative. Example 1Output: Result of clearBit operation on 15 is 11 Example 2Output: java.lang.ArithmeticException: Neagtive bit address Next TopicJava BigInteger |
Java BigInteger method The methodof java BigInteger class returns an array of two BigIntegerswith being the first one be the quotient while second index corresponds to the remainder. Syntax: public BigInteger[ ]divideAndRemainder(BigIntegerval ) Parameter: val-value by which this BigInteger is to be divided, and the remainder computed. Returns: An array...
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 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 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 is used to check whether a BigInteger value is positive, negative or zero. This method returns one of the following values depending on the following conditions : This method returns 1 when this BigInteger is positive. This...
1 min read
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 NOT of a BigInteger. This method returns a BigInteger whose value is ( ~this). Syntax: public BigInteger Parameter: NA Returns: This method returns ( ~this). Exception: NA Note: This method returns a negative value if and only...
1 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 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 The method of Java BigInteger class returns a BigInteger whose value is the absolute value of this BigInteger. This method is very useful if we are dealing only with unsigned integer. Syntax: public BigInteger abs ( ) Parameter: NA Returns: This method returns the absolute value of...
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