| java.lang.Object java.math.Elementary
Elementary | class Elementary (Code) | | Static library that provides the basic arithmetic mutable operations for
BigInteger . The operations provided are listed below.
- Addition.
- Subtraction.
- Comparison.
In addition to this, some Inplace (mutable) methods are provided.
author: Intel Middleware Product Division author: Instituto Tecnologico de Cordoba |
Method Summary | |
static BigInteger | add(BigInteger op1, BigInteger op2) | static int | compareArrays(int[] a, int[] b, int size) Compares two arrays. | static void | completeInPlaceAdd(BigInteger op1, BigInteger op2) | static void | completeInPlaceSubtract(BigInteger op1, BigInteger op2) | static void | inplaceAdd(BigInteger op1, BigInteger op2) Performs
op1 += op2 . | static int | inplaceAdd(int a, int aSize, int addend) Adds an integer value to the array of integers remembering carry. | static void | inplaceAdd(BigInteger op1, int addend) Performs:
op1 += addend . | static void | inplaceSubtract(BigInteger op1, BigInteger op2) Performs
op1 -= op2 . | static BigInteger | subtract(BigInteger op1, BigInteger op2) |
compareArrays | static int compareArrays(int[] a, int[] b, int size)(Code) | | Compares two arrays. All elements are treated as unsigned integers. The
magnitude is the bit chain of elements in big-endian order.
Parameters: a - the first array Parameters: b - the second array Parameters: size - the size of arrays 1 if a > b, -1 if a < b, 0 if a == b |
completeInPlaceAdd | static void completeInPlaceAdd(BigInteger op1, BigInteger op2)(Code) | | Same as @link #inplaceAdd(BigInteger, BigInteger), but without the restriction of
non-positive values
Parameters: op1 - any number Parameters: op2 - any number |
completeInPlaceSubtract | static void completeInPlaceSubtract(BigInteger op1, BigInteger op2)(Code) | | Same as
#inplaceSubtract(BigInteger, BigInteger), but without therestriction of non-positive values Parameters: op1 - should have enough space to save the result Parameters: op2 - |
inplaceAdd | static void inplaceAdd(BigInteger op1, BigInteger op2)(Code) | | Performs
op1 += op2 .
op1 must have enough place to store
the result (i.e.
op1.bitLength() >= op2.bitLength() ). Both
should be positive (i.e.
op1 >= op2 ).
Parameters: op1 - the input minuend, and the output result. Parameters: op2 - the addend |
inplaceAdd | static int inplaceAdd(int a, int aSize, int addend)(Code) | | Adds an integer value to the array of integers remembering carry.
a possible generated carry (0 or 1) |
inplaceAdd | static void inplaceAdd(BigInteger op1, int addend)(Code) | | Performs:
op1 += addend . The number must to have place to hold a
possible carry.
|
inplaceSubtract | static void inplaceSubtract(BigInteger op1, BigInteger op2)(Code) | | Performs
op1 -= op2 .
op1 must have enough place to store
the result (i.e.
op1.bitLength() >= op2.bitLength() ). Both
should be positive (what implies that
op1 >= op2 ).
Parameters: op1 - the input minuend, and the output result. Parameters: op2 - the subtrahend |
|
|