Java BigInteger flipBit() methodThe flipBit() method of Java BigInteger class is used to flip a particular bit position in a BigInteger.This method returns the BigInteger after flipping its bit at index n. Syntax:Parameter:n- The position of the bit to be flipped Return valueThis method returns a BigInteger object whose value is, this ^ (1<< n). Throws:ArithmeticException? if n is negative. Example 1Test it NowOutput: FlipBit operation on 5 at index 1 gives 7 Example 2Test it NowOutput: java.lang.ArithmeticException: Negative bit address Next TopicJava BigInteger |
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