Java Math BigInteger.setBit() 方法


Java Math BigInteger.setBit() 方法

package com.codingdict;



import java.math.*;



public class BigIntegerDemo {



   public static void main(String[] args) {



      // create 2 BigInteger objects

      BigInteger bi1, bi2;



      bi1 = new BigInteger("7");



      // perform setbit operation on bi1 using index 3

      bi2 = bi1.setBit(3);



      String str = "Setbit operation on " +bi1+ " at index 3 gives " +bi2;



      // print bi2 value

      System.out.println( str );

   }

}