Description Of BigInteger: shiftLeft(int n)
The java.math.BigInteger.shiftLeft(int n) BigInteger whose value is (this << n). The shift distance, n , may be negative, in which case this method performs a right shift. (Computes floor(this * 2n))BigInteger.shiftLeft(int n) method returns this << n
Code Example Java BigInteger
import java.math.BigInteger;
public class BigIntegerExam {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("10");
// perform leftshift operation on bi1 using 2 and -2
BigInteger bi2 = bi1.shiftLeft(2);
BigInteger bi3 = bi1.shiftLeft(-2);
System.out.println(bi2);
System.out.println(bi3);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น