Java Doc for BigInteger.java in  » 6.0-JDK-Modules » j2me » java » math » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.math 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.lang.Number
      java.math.BigInteger

BigInteger
public class BigInteger extends Number implements Comparable(Code)
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 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.
See Also:   BigDecimal
version:
   1.36, 04/21/00
author:
   Josh Bloch
author:
   Michael McCloskey
since:
   JDK1.1



Field Summary
final public static  BigIntegerONE
     The BigInteger constant one.
final public static  BigIntegerZERO
     The BigInteger constant zero.
static  int[]bnExpModThreshTable
    
transient  int[]mag
     The magnitude of this BigInteger, in big-endian order: the zeroth element of this array is the most-significant int of the magnitude.
 intsignum
     The signum of this BigInteger: -1 for negative, 0 for zero, or 1 for positive.
final static  bytetrailingZeroTable
    

Constructor Summary
public  BigInteger(byte[] val)
     Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger.
public  BigInteger(int signum, byte[] magnitude)
     Translates the sign-magnitude representation of a BigInteger into a BigInteger.
public  BigInteger(String val, int radix)
     Translates the String representation of a BigInteger in the specified radix into a BigInteger.
 BigInteger(char[] val)
    
public  BigInteger(String val)
     Translates the decimal String representation of a BigInteger into a BigInteger.
public  BigInteger(int numBits, Random rnd)
     Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2numBits - 1), inclusive. The uniformity of the distribution assumes that a fair source of random bits is provided in rnd.
public  BigInteger(int bitLength, int certainty, Random rnd)
     Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.

It is recommended that the BigInteger.probablePrime probablePrime method be used in preference to this constructor unless there is a compelling need to specify a certainty.
Parameters:
  bitLength - bitLength of the returned BigInteger.
Parameters:
  certainty - a measure of the uncertainty that the caller iswilling to tolerate.

 BigInteger(MutableBigInteger val, int sign)
     This private constructor is for internal use in converting from a MutableBigInteger object into a BigInteger.

Method Summary
public  BigIntegerabs()
     Returns a BigInteger whose value is the absolute value of this BigInteger.
public  BigIntegeradd(BigInteger val)
     Returns a BigInteger whose value is (this + val).
Parameters:
  val - value to be added to this BigInteger.
static  intaddOne(int[] a, int offset, int mlen, int carry)
     Add one word to the number a mlen words into a.
public  BigIntegerand(BigInteger val)
     Returns a BigInteger whose value is (this & val).
public  BigIntegerandNot(BigInteger val)
     Returns a BigInteger whose value is (this & ~val).
static  intbitCnt(int val)
    
public  intbitCount()
     Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit.
static  intbitLen(int w)
     bitLen(val) is the number of bits in val.
public  intbitLength()
     Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation.
public  BigIntegerclearBit(int n)
     Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared. (Computes (this & ~(1<<n)).)
Parameters:
  n - index of bit to clear.
public  intcompareTo(BigInteger val)
     Compares this BigInteger with the specified BigInteger.
public  intcompareTo(Object o)
     Compares this BigInteger with the specified Object.
public  BigIntegerdivide(BigInteger val)
     Returns a BigInteger whose value is (this / val).
Parameters:
  val - value by which this BigInteger is to be divided.
public  BigInteger[]divideAndRemainder(BigInteger val)
     Returns an array of two BigIntegers containing (this / val) followed by (this % val).
Parameters:
  val - value by which this BigInteger is to be divided, and theremainder computed.
public  doubledoubleValue()
     Converts this BigInteger to a double.
public  booleanequals(Object x)
     Compares this BigInteger with the specified Object for equality.
Parameters:
  x - Object to which this BigInteger is to be compared.
public  BigIntegerflipBit(int n)
     Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped. (Computes (this ^ (1<<n)).)
Parameters:
  n - index of bit to flip.
public  floatfloatValue()
     Converts this BigInteger to a float.
public  BigIntegergcd(BigInteger val)
     Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val).
public  intgetLowestSetBit()
     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).
public  inthashCode()
     Returns the hash code for this BigInteger.
public  intintValue()
     Converts this BigInteger to an int.
public  booleanisProbablePrime(int certainty)
     Returns true if this BigInteger is probably prime, false if it's definitely composite.
 intjacobiSymbol(int p, BigInteger n)
     Computes Jacobi(p,n).
 int[]javaIncrement(int[] val)
    
public  longlongValue()
     Converts this BigInteger to a long.
public  BigIntegermax(BigInteger val)
     Returns the maximum of this BigInteger and val.
Parameters:
  val - value with with the maximum is to be computed.
public  BigIntegermin(BigInteger val)
     Returns the minimum of this BigInteger and val.
Parameters:
  val - value with with the minimum is to be computed.
public  BigIntegermod(BigInteger m)
     Returns a BigInteger whose value is (this mod m).
public  BigIntegermodInverse(BigInteger m)
     Returns a BigInteger whose value is (this-1 mod m).
Parameters:
  m - the modulus.
public  BigIntegermodPow(BigInteger exponent, BigInteger m)
     Returns a BigInteger whose value is (thisexponent mod m).
static  intmulAdd(int[] out, int[] in, int offset, int len, int k)
    
public  BigIntegermultiply(BigInteger val)
     Returns a BigInteger whose value is (this * val).
Parameters:
  val - value to be multiplied by this BigInteger.
public  BigIntegernegate()
     Returns a BigInteger whose value is (-this).
public  BigIntegernot()
     Returns a BigInteger whose value is (~this).
public  BigIntegeror(BigInteger val)
     Returns a BigInteger whose value is (this | val).
public  BigIntegerpow(int exponent)
     Returns a BigInteger whose value is (thisexponent). Note that exponent is an integer rather than a BigInteger.
Parameters:
  exponent - exponent to which this BigInteger is to be raised.
 booleanprimeToCertainty(int certainty)
     Returns true if this BigInteger is probably prime, false if it's definitely composite. This method assumes bitLength > 2.
Parameters:
  certainty - a measure of the uncertainty that the caller iswilling to tolerate: if the call returns truethe probability that this BigInteger is prime exceeds(1 - 1/2certainty).
static  voidprimitiveLeftShift(int[] a, int len, int n)
    
static  voidprimitiveRightShift(int[] a, int len, int n)
    
public  BigIntegerremainder(BigInteger val)
     Returns a BigInteger whose value is (this % val).
Parameters:
  val - value by which this BigInteger is to be divided, and theremainder computed.
public  BigIntegersetBit(int n)
     Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set.
public  BigIntegershiftLeft(int n)
     Returns a BigInteger whose value is (this << n). The shift distance, n, may be negative, in which case this method performs a right shift. (Computes floor(this * 2n).)
Parameters:
  n - shift distance, in bits.
public  BigIntegershiftRight(int n)
     Returns a BigInteger whose value is (this >> n).
public  intsignum()
     Returns the signum function of this BigInteger.
public  BigIntegersubtract(BigInteger val)
     Returns a BigInteger whose value is (this - val).
Parameters:
  val - value to be subtracted from this BigInteger.
public  booleantestBit(int n)
     Returns true if and only if the designated bit is set. (Computes ((this & (1<<n)) != 0).)
Parameters:
  n - index of bit to test.
public  byte[]toByteArray()
     Returns a byte array containing the two's-complement representation of this BigInteger.
public  StringtoString(int radix)
     Returns the String representation of this BigInteger in the given radix.
public  StringtoString()
     Returns the decimal String representation of this BigInteger. The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate.
static  inttrailingZeroCnt(int val)
    
public static  BigIntegervalueOf(long val)
     Returns a BigInteger whose value is equal to that of the specified long.
public  BigIntegerxor(BigInteger val)
     Returns a BigInteger whose value is (this ^ val).

Field Detail
ONE
final public static BigInteger ONE(Code)
The BigInteger constant one.
since:
   1.2



ZERO
final public static BigInteger ZERO(Code)
The BigInteger constant zero.
since:
   1.2



bnExpModThreshTable
static int[] bnExpModThreshTable(Code)



mag
transient int[] mag(Code)
The magnitude of this BigInteger, in big-endian order: the zeroth element of this array is the most-significant int of the magnitude. The magnitude must be "minimal" in that the most-significant int (mag[0]) must be non-zero. This is necessary to ensure that there is exactly one representation for each BigInteger value. Note that this implies that the BigInteger zero has a zero-length mag array.



signum
int signum(Code)
The signum of this BigInteger: -1 for negative, 0 for zero, or 1 for positive. Note that the BigInteger zero must have a signum of 0. This is necessary to ensures that there is exactly one representation for each BigInteger value.



trailingZeroTable
final static byte trailingZeroTable(Code)




Constructor Detail
BigInteger
public BigInteger(byte[] val)(Code)
Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger. The input array is assumed to be in big-endian byte-order: the most significant byte is in the zeroth element.
Parameters:
  val - big-endian two's-complement binary representation ofBigInteger.
throws:
  NumberFormatException - val is zero bytes long.



BigInteger
public BigInteger(int signum, byte[] magnitude)(Code)
Translates the sign-magnitude representation of a BigInteger into a BigInteger. The sign is represented as an integer signum value: -1 for negative, 0 for zero, or 1 for positive. The magnitude is a byte array in big-endian byte-order: the most significant byte is in the zeroth element. A zero-length magnitude array is permissible, and will result in in a BigInteger value of 0, whether signum is -1, 0 or 1.
Parameters:
  signum - signum of the number (-1 for negative, 0 for zero, 1for positive).
Parameters:
  magnitude - big-endian binary representation of the magnitude ofthe number.
throws:
  NumberFormatException - signum is not one of the threelegal values (-1, 0, and 1), or signum is 0 andmagnitude contains one or more non-zero bytes.



BigInteger
public BigInteger(String val, int radix)(Code)
Translates the String representation of a BigInteger in the specified radix into a BigInteger. The String representation consists of an optional minus sign followed by a sequence of one or more digits in the specified radix. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).
Parameters:
  val - String representation of BigInteger.
Parameters:
  radix - radix to be used in interpreting val.
throws:
  NumberFormatException - val is not a valid representationof a BigInteger in the specified radix, or radix isoutside the range from Character.MIN_RADIX toCharacter.MAX_RADIX, inclusive.
See Also:   Character.digit



BigInteger
BigInteger(char[] val)(Code)



BigInteger
public BigInteger(String val)(Code)
Translates the decimal String representation of a BigInteger into a BigInteger. The String representation consists of an optional minus sign followed by a sequence of one or more decimal digits. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).
Parameters:
  val - decimal String representation of BigInteger.
throws:
  NumberFormatException - val is not a valid representationof a BigInteger.
See Also:   Character.digit



BigInteger
public BigInteger(int numBits, Random rnd)(Code)
Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2numBits - 1), inclusive. The uniformity of the distribution assumes that a fair source of random bits is provided in rnd. Note that this constructor always constructs a non-negative BigInteger.
Parameters:
  numBits - maximum bitLength of the new BigInteger.
Parameters:
  rnd - source of randomness to be used in computing the newBigInteger.
throws:
  IllegalArgumentException - numBits is negative.
See Also:   BigInteger.bitLength



BigInteger
public BigInteger(int bitLength, int certainty, Random rnd)(Code)
Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength.

It is recommended that the BigInteger.probablePrime probablePrime method be used in preference to this constructor unless there is a compelling need to specify a certainty.
Parameters:
  bitLength - bitLength of the returned BigInteger.
Parameters:
  certainty - a measure of the uncertainty that the caller iswilling to tolerate. The probability that the new BigIntegerrepresents a prime number will exceed(1 - 1/2certainty). The execution time ofthis constructor is proportional to the value of this parameter.
Parameters:
  rnd - source of random bits used to select candidates to betested for primality.
throws:
  ArithmeticException - bitLength < 2.
See Also:   BigInteger.bitLength




BigInteger
BigInteger(MutableBigInteger val, int sign)(Code)
This private constructor is for internal use in converting from a MutableBigInteger object into a BigInteger.




Method Detail
abs
public BigInteger abs()(Code)
Returns a BigInteger whose value is the absolute value of this BigInteger. abs(this)



add
public BigInteger add(BigInteger val)(Code)
Returns a BigInteger whose value is (this + val).
Parameters:
  val - value to be added to this BigInteger. this + val



addOne
static int addOne(int[] a, int offset, int mlen, int carry)(Code)
Add one word to the number a mlen words into a. Return the resulting carry.



and
public BigInteger and(BigInteger val)(Code)
Returns a BigInteger whose value is (this & val). (This method returns a negative BigInteger if and only if this and val are both negative.)
Parameters:
  val - value to be AND'ed with this BigInteger. this & val



andNot
public BigInteger andNot(BigInteger val)(Code)
Returns a BigInteger whose value is (this & ~val). This method, which is equivalent to and(val.not()), is provided as a convenience for masking operations. (This method returns a negative BigInteger if and only if this is negative and val is positive.)
Parameters:
  val - value to be complemented and AND'ed with this BigInteger. this & ~val



bitCnt
static int bitCnt(int val)(Code)



bitCount
public int bitCount()(Code)
Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit. This method is useful when implementing bit-vector style sets atop BigIntegers. number of bits in the two's complement representationof this BigInteger that differ from its sign bit.



bitLen
static int bitLen(int w)(Code)
bitLen(val) is the number of bits in val.



bitLength
public int bitLength()(Code)
Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. (Computes (ceil(log2(this < 0 ? -this : this+1))).) number of bits in the minimal two's-complementrepresentation of this BigInteger, excluding a sign bit.



clearBit
public BigInteger clearBit(int n)(Code)
Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared. (Computes (this & ~(1<<n)).)
Parameters:
  n - index of bit to clear. this & ~(1<<n)
throws:
  ArithmeticException - n is negative.



compareTo
public int compareTo(BigInteger val)(Code)
Compares this BigInteger with the specified BigInteger. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) <op> 0), where <op> is one of the six comparison operators.
Parameters:
  val - BigInteger to which this BigInteger is to be compared. -1, 0 or 1 as this BigInteger is numerically less than, equalto, or greater than val.



compareTo
public int compareTo(Object o)(Code)
Compares this BigInteger with the specified Object. If the Object is a BigInteger, this method behaves like compareTo(BigInteger). Otherwise, it throws a ClassCastException (as BigIntegers are comparable only to other BigIntegers).
Parameters:
  o - Object to which this BigInteger is to be compared. a negative number, zero, or a positive number as thisBigInteger is numerically less than, equal to, or greaterthan o, which must be a BigInteger.
throws:
  ClassCastException - o is not a BigInteger.
See Also:   BigInteger.compareTo(java.math.BigInteger)
See Also:   Comparable
since:
   1.2



divide
public BigInteger divide(BigInteger val)(Code)
Returns a BigInteger whose value is (this / val).
Parameters:
  val - value by which this BigInteger is to be divided. this / val
throws:
  ArithmeticException - val==0



divideAndRemainder
public BigInteger[] divideAndRemainder(BigInteger val)(Code)
Returns an array of two BigIntegers containing (this / val) followed by (this % val).
Parameters:
  val - value by which this BigInteger is to be divided, and theremainder computed. an array of two BigIntegers: the quotient (this / val)is the initial element, and the remainder (this % val)is the final element.
throws:
  ArithmeticException - val==0



doubleValue
public double doubleValue()(Code)
Converts this BigInteger to a double. This conversion is similar to the narrowing primitive conversion from double to float defined in the Java Language Specification: if this BigInteger has too great a magnitude to represent as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate. Note that even when the return value is finite, this conversion can lose information about the precision of the BigInteger value. this BigInteger converted to a double.



equals
public boolean equals(Object x)(Code)
Compares this BigInteger with the specified Object for equality.
Parameters:
  x - Object to which this BigInteger is to be compared. true if and only if the specified Object is aBigInteger whose value is numerically equal to this BigInteger.



flipBit
public BigInteger flipBit(int n)(Code)
Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped. (Computes (this ^ (1<<n)).)
Parameters:
  n - index of bit to flip. this ^ (1<<n)
throws:
  ArithmeticException - n is negative.



floatValue
public float floatValue()(Code)
Converts this BigInteger to a float. This conversion is similar to the narrowing primitive conversion from double to float defined in the Java Language Specification: if this BigInteger has too great a magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate. Note that even when the return value is finite, this conversion can lose information about the precision of the BigInteger value. this BigInteger converted to a float.



gcd
public BigInteger gcd(BigInteger val)(Code)
Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val). Returns 0 if this==0 && val==0.
Parameters:
  val - value with with the GCD is to be computed. GCD(abs(this), abs(val))



getLowestSetBit
public int getLowestSetBit()(Code)
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). Returns -1 if this BigInteger contains no one bits. (Computes (this==0? -1 : log2(this & -this)).) index of the rightmost one bit in this BigInteger.



hashCode
public int hashCode()(Code)
Returns the hash code for this BigInteger. hash code for this BigInteger.



intValue
public int intValue()(Code)
Converts this BigInteger to an int. This conversion is analogous to a narrowing primitive conversion from long to int as defined in the Java Language Specification: if this BigInteger is too big to fit in an int, only the low-order 32 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInteger value as well as return a result with the opposite sign. this BigInteger converted to an int.



isProbablePrime
public boolean isProbablePrime(int certainty)(Code)
Returns true if this BigInteger is probably prime, false if it's definitely composite. If certainty is <= 0, true is returned.
Parameters:
  certainty - a measure of the uncertainty that the caller iswilling to tolerate: if the call returns truethe probability that this BigInteger is prime exceeds(1 - 1/2certainty). The execution time ofthis method is proportional to the value of this parameter. true if this BigInteger is probably prime,false if it's definitely composite.



jacobiSymbol
int jacobiSymbol(int p, BigInteger n)(Code)
Computes Jacobi(p,n). Assumes n is positive, odd.



javaIncrement
int[] javaIncrement(int[] val)(Code)



longValue
public long longValue()(Code)
Converts this BigInteger to a long. This conversion is analogous to a narrowing primitive conversion from long to int as defined in the Java Language Specification: if this BigInteger is too big to fit in a long, only the low-order 64 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInteger value as well as return a result with the opposite sign. this BigInteger converted to a long.



max
public BigInteger max(BigInteger val)(Code)
Returns the maximum of this BigInteger and val.
Parameters:
  val - value with with the maximum is to be computed. the BigInteger whose value is the greater of this andval. If they are equal, either may be returned.



min
public BigInteger min(BigInteger val)(Code)
Returns the minimum of this BigInteger and val.
Parameters:
  val - value with with the minimum is to be computed. the BigInteger whose value is the lesser of this BigInteger and val. If they are equal, either may be returned.



mod
public BigInteger mod(BigInteger m)(Code)
Returns a BigInteger whose value is (this mod m). This method differs from remainder in that it always returns a non-negative BigInteger.
Parameters:
  m - the modulus. this mod m
throws:
  ArithmeticException - m <= 0
See Also:   BigInteger.remainder



modInverse
public BigInteger modInverse(BigInteger m)(Code)
Returns a BigInteger whose value is (this-1 mod m).
Parameters:
  m - the modulus. this-1 mod m.
throws:
  ArithmeticException - m <= 0, or this BigIntegerhas no multiplicative inverse mod m (that is, this BigIntegeris not relatively prime to m).



modPow
public BigInteger modPow(BigInteger exponent, BigInteger m)(Code)
Returns a BigInteger whose value is (thisexponent mod m). (Unlike pow, this method permits negative exponents.)
Parameters:
  exponent - the exponent.
Parameters:
  m - the modulus. thisexponent mod m
throws:
  ArithmeticException - m <= 0
See Also:   BigInteger.modInverse



mulAdd
static int mulAdd(int[] out, int[] in, int offset, int len, int k)(Code)
Multiply an array by one word k and add to result, return the carry



multiply
public BigInteger multiply(BigInteger val)(Code)
Returns a BigInteger whose value is (this * val).
Parameters:
  val - value to be multiplied by this BigInteger. this * val



negate
public BigInteger negate()(Code)
Returns a BigInteger whose value is (-this). -this



not
public BigInteger not()(Code)
Returns a BigInteger whose value is (~this). (This method returns a negative value if and only if this BigInteger is non-negative.) ~this



or
public BigInteger or(BigInteger val)(Code)
Returns a BigInteger whose value is (this | val). (This method returns a negative BigInteger if and only if either this or val is negative.)
Parameters:
  val - value to be OR'ed with this BigInteger. this | val



pow
public BigInteger pow(int exponent)(Code)
Returns a BigInteger whose value is (thisexponent). Note that exponent is an integer rather than a BigInteger.
Parameters:
  exponent - exponent to which this BigInteger is to be raised. thisexponent
throws:
  ArithmeticException - exponent is negative. (This wouldcause the operation to yield a non-integer value.)



primeToCertainty
boolean primeToCertainty(int certainty)(Code)
Returns true if this BigInteger is probably prime, false if it's definitely composite. This method assumes bitLength > 2.
Parameters:
  certainty - a measure of the uncertainty that the caller iswilling to tolerate: if the call returns truethe probability that this BigInteger is prime exceeds(1 - 1/2certainty). The execution time ofthis method is proportional to the value of this parameter. true if this BigInteger is probably prime,false if it's definitely composite.



primitiveLeftShift
static void primitiveLeftShift(int[] a, int len, int n)(Code)



primitiveRightShift
static void primitiveRightShift(int[] a, int len, int n)(Code)



remainder
public BigInteger remainder(BigInteger val)(Code)
Returns a BigInteger whose value is (this % val).
Parameters:
  val - value by which this BigInteger is to be divided, and theremainder computed. this % val
throws:
  ArithmeticException - val==0



setBit
public BigInteger setBit(int n)(Code)
Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set. (Computes (this | (1<<n)).)
Parameters:
  n - index of bit to set. this | (1<<n)
throws:
  ArithmeticException - n is negative.



shiftLeft
public BigInteger shiftLeft(int n)(Code)
Returns a BigInteger whose value is (this << n). The shift distance, n, may be negative, in which case this method performs a right shift. (Computes floor(this * 2n).)
Parameters:
  n - shift distance, in bits. this << n
See Also:   BigInteger.shiftRight



shiftRight
public BigInteger shiftRight(int n)(Code)
Returns a BigInteger whose value is (this >> n). Sign extension is performed. The shift distance, n, may be negative, in which case this method performs a left shift. (Computes floor(this / 2n).)
Parameters:
  n - shift distance, in bits. this >> n
See Also:   BigInteger.shiftLeft



signum
public int signum()(Code)
Returns the signum function of this BigInteger. -1, 0 or 1 as the value of this BigInteger is negative, zero orpositive.



subtract
public BigInteger subtract(BigInteger val)(Code)
Returns a BigInteger whose value is (this - val).
Parameters:
  val - value to be subtracted from this BigInteger. this - val



testBit
public boolean testBit(int n)(Code)
Returns true if and only if the designated bit is set. (Computes ((this & (1<<n)) != 0).)
Parameters:
  n - index of bit to test. true if and only if the designated bit is set.
throws:
  ArithmeticException - n is negative.



toByteArray
public byte[] toByteArray()(Code)
Returns a byte array containing the two's-complement representation of this BigInteger. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element. The array will contain the minimum number of bytes required to represent this BigInteger, including at least one sign bit, which is (ceil((this.bitLength() + 1)/8)). (This representation is compatible with the BigInteger.BigInteger(byte[]) (byte[]) constructor.) a byte array containing the two's-complement representation ofthis BigInteger.
See Also:   BigInteger.BigInteger(byte[])



toString
public String toString(int radix)(Code)
Returns the String representation of this BigInteger in the given radix. If the radix is outside the range from Character.MIN_RADIX to Character.MAX_RADIX inclusive, it will default to 10 (as is the case for Integer.toString). The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. (This representation is compatible with the BigInteger.BigInteger(String,int) (String,int) constructor.)
Parameters:
  radix - radix of the String representation. String representation of this BigInteger in the given radix.
See Also:   Integer.toString
See Also:   Character.forDigit
See Also:   BigInteger.BigInteger(java.lang.String,int)



toString
public String toString()(Code)
Returns the decimal String representation of this BigInteger. The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. (This representation is compatible with the BigInteger.BigInteger(String) (String) constructor, and allows for String concatenation with Java's + operator.) decimal String representation of this BigInteger.
See Also:   Character.forDigit
See Also:   BigInteger.BigInteger(java.lang.String)



trailingZeroCnt
static int trailingZeroCnt(int val)(Code)



valueOf
public static BigInteger valueOf(long val)(Code)
Returns a BigInteger whose value is equal to that of the specified long. This "static factory method" is provided in preference to a (long) constructor because it allows for reuse of frequently used BigIntegers.
Parameters:
  val - value of the BigInteger to return. a BigInteger with the specified value.



xor
public BigInteger xor(BigInteger val)(Code)
Returns a BigInteger whose value is (this ^ val). (This method returns a negative BigInteger if and only if exactly one of this and val are negative.)
Parameters:
  val - value to be XOR'ed with this BigInteger. this ^ val



Methods inherited from java.lang.Number
public byte byteValue()(Code)(Java Doc)
abstract public double doubleValue()(Code)(Java Doc)
abstract public float floatValue()(Code)(Java Doc)
abstract public int intValue()(Code)(Java Doc)
abstract public long longValue()(Code)(Java Doc)
public short shortValue()(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.