- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Shift left in a BigInteger in Java
To shift left in a BigInteger, use the shiftLeft() method.
The java.math.BigInteger.shiftLeft(int n) returns a BigInteger whose value is (this << n). The shift distance, n, may be negative, in which case this method performs a right shift. It computes floor(this * 2n).
Example
import java.math.*; public class Demo { public static void main(String[] args) { BigInteger one; one = new BigInteger("25"); one = one.shiftLeft(3); System.out.println("Result: " +one); } }
Output
Result: 200
- Related Articles
- Shift right in a BigInteger in Java
- Java Program to shift bits in a BigInteger
- Left Shift and Right Shift Operators in C/C++
- Negate a BigInteger in Java
- What does the bitwise left shift operator do in Java?
- Multiply one BigInteger to another BigInteger in Java
- Subtract one BigInteger from another BigInteger in Java
- Divide one BigInteger from another BigInteger in Java
- Clear a bit in a BigInteger in Java
- Java Program to shift array elements to the left
- Bitwise Right/ left shift numbers in Arduino
- Set a bit for BigInteger in Java
- BigInteger class in Java\n
- What are Left Shift and Right Shift Operators (>> and
- Explain JavaScript Bitwise NOT, Left shift and Right shift?

Advertisements