BigInteger.java (probablePrime): New.
2003-04-19 Jerry Quinn <jlquinn@optonline.net> * java/math/BigInteger.java (probablePrime): New. * java/math/BigDecimal.java (unscaledValue): New. From-SVN: r65825
This commit is contained in:
parent
f1a1591b9e
commit
afd4910af1
3 changed files with 27 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-04-19 Jerry Quinn <jlquinn@optonline.net>
|
||||
|
||||
* java/math/BigInteger.java (probablePrime): New.
|
||||
* java/math/BigDecimal.java (unscaledValue): New.
|
||||
|
||||
2003-04-19 Ranjit Mathew <rmathew@hotmail.com>
|
||||
|
||||
* java/io/File.java (getAbsolutePath): On Windows, take care
|
||||
|
|
|
@ -431,6 +431,11 @@ public class BigDecimal extends Number implements Comparable
|
|||
return scale;
|
||||
}
|
||||
|
||||
public BigInteger unscaledValue()
|
||||
{
|
||||
return intVal;
|
||||
}
|
||||
|
||||
public BigDecimal abs ()
|
||||
{
|
||||
return new BigDecimal (intVal.abs (), scale);
|
||||
|
|
|
@ -223,6 +223,23 @@ public class BigInteger extends Number implements Comparable
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a BigInteger that is bitLength bits long with a
|
||||
* probability < 2^-100 of being composite.
|
||||
*
|
||||
* @param bitLength length in bits of resulting number
|
||||
* @param rnd random number generator to use
|
||||
* @throws ArithmeticException if bitLength < 2
|
||||
* @since 1.4
|
||||
*/
|
||||
public static BigInteger probablePrime(int bitLength, Random rnd)
|
||||
{
|
||||
if (bitLength < 2)
|
||||
throw new ArithmeticException();
|
||||
|
||||
return new BigInteger(bitLength, 100, rnd);
|
||||
}
|
||||
|
||||
/** Return a (possibly-shared) BigInteger with a given long value. */
|
||||
public static BigInteger valueOf(long val)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue