- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Performing Bitwise Operations with BigInteger in Java
BigInteger class is used for big integer calculations which are outside the limit of the primitive data types. It provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.
Let us work with the testBit() method in Java to perform Bitwise operation. The java.math.BigInteger.testBit(int n) returns true if and only if the designated bit is set −
The following is an example −
Example
import java.math.*; public class BigIntegerDemo { public static void main(String[] args) { BigInteger one; Boolean two; one = new BigInteger("5"); two = one.testBit(2); System.out.println("Result: " +two); } }
Output
Result: true
- Related Articles
- Math Operations on BigInteger in Java
- Working with BigInteger Values in Java
- Final string after performing given operations in C++
- Multiply one BigInteger to another BigInteger in Java
- Subtract one BigInteger from another BigInteger in Java
- Divide one BigInteger from another BigInteger in Java
- Checking power of 2 using bitwise operations in JavaScript
- Performing mathematical operations in MySQL IF then ELSE is possible?
- Performing power operations on an array of numbers in JavaScript
- Negate a BigInteger in Java
- BigInteger class in Java\n
- Maximum Possible Product in Array after performing given Operations in C++
- Python Program to Create a class performing Calculator Operations
- Program to find maximum score from performing multiplication operations in Python
- Reduce a number to 1 by performing given operations in C++

Advertisements