Build 1.0_r1(from source)

java.math
Class Division

java.lang.Object
  extended by java.math.Division

 class Division
extends Object

Static library that provides all operations related with division and modular arithmetic to BigInteger. Some methods are provided in both mutable and immutable way. There are several variants provided listed below:


Constructor Summary
Division()
           
 
Method Summary
(package private) static BigInteger[] divideAndRemainderByInteger(BigInteger val, int divisor, int divisorSign)
          Computes the quotient and the remainder after a division by an int number.
(package private) static int divideArrayByInt(int[] dest, int[] src, int srcLength, int divisor)
          Divides an array by an integer value.
(package private) static long divideLongByInt(long a, int b)
          Divides an unsigned long a by an unsigned int b.
(package private) static int remainder(BigInteger dividend, int divisor)
          Divides a BigInteger by a signed int and returns the remainder.
(package private) static int remainderArrayByInt(int[] src, int srcLength, int divisor)
          Divides an array by an integer value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Division

Division()
Method Detail

divideArrayByInt

static int divideArrayByInt(int[] dest,
                            int[] src,
                            int srcLength,
                            int divisor)
Divides an array by an integer value. Implements the Knuth's division algorithm. See D. Knuth, The Art of Computer Programming, vol. 2.

Parameters:
dest - the quotient
src - the dividend
srcLength - the length of the dividend
divisor - the divisor
Returns:
remainder

remainderArrayByInt

static int remainderArrayByInt(int[] src,
                               int srcLength,
                               int divisor)
Divides an array by an integer value. Implements the Knuth's division algorithm. See D. Knuth, The Art of Computer Programming, vol. 2.

Parameters:
src - the dividend
srcLength - the length of the dividend
divisor - the divisor
Returns:
remainder

remainder

static int remainder(BigInteger dividend,
                     int divisor)
Divides a BigInteger by a signed int and returns the remainder.

Parameters:
dividend - the BigInteger to be divided. Must be non-negative.
divisor - a signed int
Returns:
divide % divisor

divideLongByInt

static long divideLongByInt(long a,
                            int b)
Divides an unsigned long a by an unsigned int b. It is supposed that the most significant bit of b is set to 1, i.e. b < 0="">

Parameters:
a - the dividend
b - the divisor
Returns:
the long value containing the unsigned integer remainder in the left half and the unsigned integer quotient in the right half

divideAndRemainderByInteger

static BigInteger[] divideAndRemainderByInteger(BigInteger val,
                                                int divisor,
                                                int divisorSign)
Computes the quotient and the remainder after a division by an int number.

Returns:
an array of the form [quotient, remainder].

Build 1.0_r1(from source)

Please submit a feedback, bug or feature