Java Math BigInteger.flipBit() 方法


Java Math BigInteger.flipBit() 方法

package com.codingdict;



import java.math.*;



public class BigIntegerDemo {



   public static void main(String[] args) {



      // create 2 BigInteger objects

      BigInteger bi1, bi2;



      // assign value to bi1

      bi1 = new BigInteger("8");//1000



      // perform flipbit operation on bi1 with index 1

      bi2 = bi1.flipBit(1);



      String str = "Flipbit operation on " +bi1+ " at index 1 gives " +bi2;



      // print bi2 value

      System.out.println( str );

   }

}