Performing Bitwise Operations with BigInteger : BigInteger « Data Type « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Data Type » BigInteger 




Performing Bitwise Operations with BigInteger
   
import java.math.BigInteger;

public class Main {
  public static void main(String[] argvthrows Exception {
    byte[] bytes = new byte[] { 0x10x000x00 }
    BigInteger bi = new BigInteger(bytes);
    boolean b = bi.testBit(3)
    b = bi.testBit(16)
  }
}

   
    
    
  














Related examples in the same category
1.BigInteger.isProbablePrime
2.Compute the Palindrome of a number by adding the number composed of
3.Operating with Big Integer Values
4.Create BigInteger via string
5.Create BigInteger via long type variable
6.Multiply one BigInteger to another BigInteger
7.Subtract one BigInteger from another BigInteger
8.Divide one BigInteger from another BigInteger
9.Negate a BigInteger
10.Calculate the power on a BigInteger
11.Create BigInteger from byte array
12.Get the value of a bit
13.Set a bit for BigInteger
14.Clear a bit in a BigInteger
15.Flip a bit in a BigInteger
16.Shift the bits in a BigInteger
17.Shift right in a BigInteger
18.xor a BigInteger
19.and operation on BigInteger
20.not operation for BigInteger
21.or operation for BigInteger
22.antNot operation on BigInteger
23.Retrieve the current bits in a byte array in twos-complement form.
24.Parsing and Formatting a Big Integer into Binary
25.Parsing and Formatting a Big Integer into octal
26.Parsing and Formatting a Big Integer into decimal
27.Parse and format to hexadecimal
28.Parse and format to arbitrary radix <= Character.MAX_RADIX
29.Create a BigInteger using the byte array
30.Parsing and Formatting a Byte Array into Binary
31.Parsing and Formatting a Byte Array into Octal
32.Parsing and Formatting a Byte Array into decimal
33.Parsing and Formatting a Byte Array into Hexadecimal
34.Parse binary string
35.Get byte array from BigInteger
36.Parse octal string to create BigInteger
37.Parse decimal string to create BigInteger
38.Parse hexadecimal string to create BigInteger
39.Convert BigInteger into another radix number
40.Do math operation for BigInteger
41.Operate with big integer values in code
42.Demonstration of high-precision integer arithmetic with the BigInteger classDemonstration of high-precision integer arithmetic with the BigInteger class
43.This program uses big numbers to compute the odds of winning the grand prize in a lottery.
44.BigInteger bitwise Gcd
45.BigInteger lowest numBits
46.BigInteger highest numBits
47.Is one BigInteger Divisible by another BigInteger
48.Is a BigInteger Even
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.