Java BigInteger shiftRight() methodThe shiftRight() method of Java BigInteger class is used to shift the bits to the right side by n times(shift distance). This method returns a BigInteger whose value is (this >> n). This method Computes floor (this / 2n). Syntax:Parameter:n- shift distance, in bits. Returns:This method returns (this >> n). Exception:NA Note: The shift distance n, may be negative, in which case this method performs a left shift.Example 1Test it NowOutput: Shift Right operation on 5, 2 times gives 1 Example 2Test it NowOutput: Shift Right operation on 5, -2 times gives 20 Example 3Test it NowOutput: Shift Right operation on 1, 4 times gives 0 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