Build 1.0_r1(from source)

java.math
Class Multiplication

java.lang.Object
  extended by java.math.Multiplication

 class Multiplication
extends Object

Static library that provides all multiplication of BigInteger methods.


Field Summary
(package private) static BigInteger[] bigFivePows
          An array with the first powers of five in BigInteger version.
(package private) static BigInteger[] bigTenPows
          An array with the first powers of ten in BigInteger version.
(package private) static int[] fivePows
          An array with powers of five that fit in the type int.
(package private) static int[] tenPows
          An array with powers of ten that fit in the type int.
 
Method Summary
(package private) static BigInteger multiplyByFivePow(BigInteger val, int exp)
          Multiplies a number by a power of five.
(package private) static BigInteger multiplyByPositiveInt(BigInteger val, int factor)
          Multiplies a number by a positive integer.
(package private) static BigInteger multiplyByTenPow(BigInteger val, long exp)
          Multiplies a number by a power of ten.
(package private) static BigInteger powerOf10(long exp)
          It calculates a power of ten, which exponent could be out of 32-bit range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tenPows

static final int[] tenPows
An array with powers of ten that fit in the type int. (10^0,10^1,...,10^9)


fivePows

static final int[] fivePows
An array with powers of five that fit in the type int. (5^0,5^1,...,5^13)


bigTenPows

static final BigInteger[] bigTenPows
An array with the first powers of ten in BigInteger version. (10^0,10^1,...,10^31)


bigFivePows

static final BigInteger[] bigFivePows
An array with the first powers of five in BigInteger version. (5^0,5^1,...,5^31)

Method Detail

multiplyByPositiveInt

static BigInteger multiplyByPositiveInt(BigInteger val,
                                        int factor)
Multiplies a number by a positive integer.

Parameters:
val - an arbitrary BigInteger
factor - a positive int number
Returns:
val * factor

multiplyByTenPow

static BigInteger multiplyByTenPow(BigInteger val,
                                   long exp)
Multiplies a number by a power of ten. This method is used in BigDecimal class.

Parameters:
val - the number to be multiplied
exp - a positive long exponent
Returns:
val * 10<sup>exp</sup>

powerOf10

static BigInteger powerOf10(long exp)
It calculates a power of ten, which exponent could be out of 32-bit range. Note that internally this method will be used in the worst case with an exponent equals to: Integer.MAX_VALUE - Integer.MIN_VALUE.

Parameters:
exp - the exponent of power of ten, it must be positive.
Returns:
a BigInteger with value 10<sup>exp</sup>.

multiplyByFivePow

static BigInteger multiplyByFivePow(BigInteger val,
                                    int exp)
Multiplies a number by a power of five. This method is used in BigDecimal class.

Parameters:
val - the number to be multiplied
exp - a positive int exponent
Returns:
val * 5<sup>exp</sup>

Build 1.0_r1(from source)

Please submit a feedback, bug or feature