Java BigInteger.flipBit(int n)
Syntax
BigInteger.flipBit(int n) has the following syntax.
public BigInteger flipBit(int n)
Example
In the following code shows how to use BigInteger.flipBit(int n) method.
/* ww w . j a v a 2s.c om*/
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
// assign value to bi1
BigInteger bi1 = new BigInteger("8");// 1000
// perform flipbit operation on bi1 with index 1
BigInteger bi2 = bi1.flipBit(1);
System.out.println(bi2);
}
}
The code above generates the following result.