Write java in big data

Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in two's-complement notation (like Java's primitive integer types). BigInteger provides analogues to all of Java's primitive integer operators, and all relevant methods from java.lang.Math. Additionally, BigInteger provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations. Semantics of arithmetic operations exactly mimic those of Java's integer arithmetic operators, as defined in The Java Language Specification. For example, division by zero throws an ArithmeticException , and division of a negative by a positive yields a negative (or zero) remainder. All of the details in the Spec concerning overflow are ignored, as BigIntegers are made as large as necessary to accommodate the results of an operation. Semantics of shift operations extend those of Java's shift operators to allow for negative shift distances. A right-shift with a negative shift distance results in a left shift, and vice-versa. The unsigned right shift operator ( >>> ) is omitted, as this operation makes little sense in combination with the "infinite word size" abstraction provided by this class. Semantics of bitwise logical operations exactly mimic those of Java's bitwise integer operators. The binary operators ( and , or , xor ) implicitly perform sign extension on the shorter of the two operands prior to performing the operation. Comparison operations perform signed integer comparisons, analogous to those performed by Java's relational and equality operators. Modular arithmetic operations are provided to compute residues, perform exponentiation, and compute multiplicative inverses. These methods always return a non-negative result, between 0 and (modulus - 1) , inclusive. Bit operations operate on a single bit of the two's-complement representation of their operand. If necessary, the operand is sign- extended so that it contains the designated bit. None of the single-bit operations can produce a BigInteger with a different sign from the BigInteger being operated on, as they affect only a single bit, and the "infinite word size" abstraction provided by this class ensures that there are infinitely many "virtual sign bits" preceding each BigInteger. For the sake of brevity and clarity, pseudo-code is used throughout the descriptions of BigInteger methods. The pseudo-code expression (i + j) is shorthand for "a BigInteger whose value is that of the BigInteger i plus that of the BigInteger j ." The pseudo-code expression (i == j) is shorthand for " true if and only if the BigInteger i represents the same value as the BigInteger j ." Other pseudo-code expressions are interpreted similarly. All methods and constructors in this class throw NullPointerException when passed a null object reference for any input parameter. BigInteger must support values in the range -2 Integer.MAX_VALUE (exclusive) to +2 Integer.MAX_VALUE (exclusive) and may support values outside of that range. The range of probable prime values is limited and may be less than the full supported positive range of BigInteger . The range must be at least 1 to 2 500000000 .

Field Summary

Fields
Modifier and Type Field and Description
static BigInteger ONE
The BigInteger constant one. The BigInteger constant ten. The BigInteger constant zero.

Constructor Summary

Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger.

Translates the sign-magnitude representation of a BigInteger into a BigInteger.

Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.

Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2 numBits - 1), inclusive.

Translates the decimal String representation of a BigInteger into a BigInteger. Translates the String representation of a BigInteger in the specified radix into a BigInteger.

Method Summary

All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type Method and Description
BigInteger abs ()
Returns a BigInteger whose value is the absolute value of this BigInteger. Returns a BigInteger whose value is (this + val) . Returns a BigInteger whose value is (this & val) . Returns a BigInteger whose value is (this & ~val) .

Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit.

Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.

Converts this BigInteger to a byte , checking for lost information. Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared. Compares this BigInteger with the specified BigInteger. Returns a BigInteger whose value is (this / val) . Returns an array of two BigIntegers containing (this / val) followed by (this % val) . Converts this BigInteger to a double . Compares this BigInteger with the specified Object for equality. Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped. Converts this BigInteger to a float . Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val) .

Returns the index of the rightmost (lowest-order) one bit in this BigInteger (the number of zero bits to the right of the rightmost one bit).