Java Doc for MutableBigInteger.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.math.MutableBigInteger

All known Subclasses:   java.math.SignedMutableBigInteger,
MutableBigInteger
class MutableBigInteger (Code)
A class used to represent multiprecision integers that makes efficient use of allocated space by allowing a number to occupy only part of an array so that the arrays do not have to be reallocated as often. When performing an operation with many iterations the array used to hold a number is only reallocated when necessary and does not have to be the same size as the number it represents. A mutable number allows calculations to occur on the same number without having to create a new number for every step of the calculation as occurs with BigIntegers.
See Also:   BigInteger
version:
   1.7, 02/02/00
author:
   Michael McCloskey
since:
   1.3


Field Summary
 intintLen
     The number of ints of the value array that are currently used to hold the magnitude of this MutableBigInteger.
 intoffset
     The offset into the value array where the magnitude of this MutableBigInteger begins.
 int[]value
     Holds the magnitude of this MutableBigInteger in big endian order.

Constructor Summary
 MutableBigInteger()
     The default constructor.
 MutableBigInteger(int val)
     Construct a new MutableBigInteger with a magnitude specified by the int val.
 MutableBigInteger(int[] val, int len)
     Construct a new MutableBigInteger with the specified value array up to the specified length.
 MutableBigInteger(int[] val)
     Construct a new MutableBigInteger with the specified value array up to the length of the array supplied.
 MutableBigInteger(BigInteger b)
     Construct a new MutableBigInteger with a magnitude equal to the specified BigInteger.
 MutableBigInteger(MutableBigInteger val)
     Construct a new MutableBigInteger with a magnitude equal to the specified MutableBigInteger.

Method Summary
 voidadd(MutableBigInteger addend)
     Adds the contents of two MutableBigInteger objects.The result is placed within this MutableBigInteger.
static  intbinaryGcd(int a, int b)
     Calculate GCD of a and b interpreted as unsigned integers.
 voidclear()
     Clear out a MutableBigInteger for reuse.
final  intcompare(MutableBigInteger b)
     Compare the magnitude of two MutableBigIntegers.
 voidcopyValue(MutableBigInteger val)
     Sets this MutableBigInteger's value array to a copy of the specified array.
 voidcopyValue(int[] val)
     Sets this MutableBigInteger's value array to a copy of the specified array.
 voiddivide(MutableBigInteger b, MutableBigInteger quotient, MutableBigInteger rem)
     Calculates the quotient and remainder of this div b and places them in the MutableBigInteger objects provided.
 voiddivideOneWord(int divisor, MutableBigInteger quotient)
     This method is used for division of an n word dividend by a one word divisor.
 MutableBigIntegereuclidModInverse(int k)
     Uses the extended Euclidean algorithm to compute the modInverse of base mod a modulus that is a power of 2.
static  MutableBigIntegerfixup(MutableBigInteger c, MutableBigInteger p, int k)
    
 MutableBigIntegerhybridGCD(MutableBigInteger b)
     Calculate GCD of this and b.
static  intinverseMod32(int val)
    
 booleanisEven()
     Returns true iff this MutableBigInteger is even.
 booleanisNormal()
     Returns true iff this MutableBigInteger is in normal form.
 booleanisOdd()
     Returns true iff this MutableBigInteger is odd.
 booleanisOne()
     Returns true iff this MutableBigInteger has a value of one.
 booleanisZero()
     Returns true iff this MutableBigInteger has a value of zero.
 voidleftShift(int n)
     Left shift this MutableBigInteger n bits.
static  MutableBigIntegermodInverseBP2(MutableBigInteger mod, int k)
    
 MutableBigIntegermodInverseMP2(int k)
    
 voidmul(int y, MutableBigInteger z)
     Multiply the contents of this MutableBigInteger by the word y.
 voidmultiply(MutableBigInteger y, MutableBigInteger z)
     Multiply the contents of two MutableBigInteger objects.
 MutableBigIntegermutableModInverse(MutableBigInteger p)
     Returns the modInverse of this mod p.
final  voidnormalize()
     Ensure that the MutableBigInteger is in normal form, specifically making sure that there are no leading zeros, and that if the magnitude is zero, then intLen is zero.
 voidreset()
     Set a MutableBigInteger to zero, removing its offset.
 voidrightShift(int n)
     Right shift this MutableBigInteger n bits.
 voidsetInt(int index, int val)
     Sets the int at index+offset in this MutableBigInteger to val.
 voidsetValue(int[] val, int length)
     Sets this MutableBigInteger's value array to the specified array.
 intsubtract(MutableBigInteger b)
     Subtracts the smaller of this and b from the larger and places the result into this MutableBigInteger.
 int[]toIntArray()
     Convert this MutableBigInteger into an int array with no leading zeros, of a length that is equal to this MutableBigInteger's intLen.
public  StringtoString()
     Returns a String representation of this MutableBigInteger in radix 10.

Field Detail
intLen
int intLen(Code)
The number of ints of the value array that are currently used to hold the magnitude of this MutableBigInteger. The magnitude starts at an offset and offset + intLen may be less than value.length.



offset
int offset(Code)
The offset into the value array where the magnitude of this MutableBigInteger begins.



value
int[] value(Code)
Holds the magnitude of this MutableBigInteger in big endian order. The magnitude may start at an offset into the value array, and it may end before the length of the value array.




Constructor Detail
MutableBigInteger
MutableBigInteger()(Code)
The default constructor. An empty MutableBigInteger is created with a one word capacity.



MutableBigInteger
MutableBigInteger(int val)(Code)
Construct a new MutableBigInteger with a magnitude specified by the int val.



MutableBigInteger
MutableBigInteger(int[] val, int len)(Code)
Construct a new MutableBigInteger with the specified value array up to the specified length.



MutableBigInteger
MutableBigInteger(int[] val)(Code)
Construct a new MutableBigInteger with the specified value array up to the length of the array supplied.



MutableBigInteger
MutableBigInteger(BigInteger b)(Code)
Construct a new MutableBigInteger with a magnitude equal to the specified BigInteger.



MutableBigInteger
MutableBigInteger(MutableBigInteger val)(Code)
Construct a new MutableBigInteger with a magnitude equal to the specified MutableBigInteger.




Method Detail
add
void add(MutableBigInteger addend)(Code)
Adds the contents of two MutableBigInteger objects.The result is placed within this MutableBigInteger. The contents of the addend are not changed.



binaryGcd
static int binaryGcd(int a, int b)(Code)
Calculate GCD of a and b interpreted as unsigned integers.



clear
void clear()(Code)
Clear out a MutableBigInteger for reuse.



compare
final int compare(MutableBigInteger b)(Code)
Compare the magnitude of two MutableBigIntegers. Returns -1, 0 or 1 as this MutableBigInteger is numerically less than, equal to, or greater than b.



copyValue
void copyValue(MutableBigInteger val)(Code)
Sets this MutableBigInteger's value array to a copy of the specified array. The intLen is set to the length of the new array.



copyValue
void copyValue(int[] val)(Code)
Sets this MutableBigInteger's value array to a copy of the specified array. The intLen is set to the length of the specified array.



divide
void divide(MutableBigInteger b, MutableBigInteger quotient, MutableBigInteger rem)(Code)
Calculates the quotient and remainder of this div b and places them in the MutableBigInteger objects provided. Uses Algorithm D in Knuth section 4.3.1. Many optimizations to that algorithm have been adapted from the Colin Plumb C library. It special cases one word divisors for speed. The contents of a and b are not changed.



divideOneWord
void divideOneWord(int divisor, MutableBigInteger quotient)(Code)
This method is used for division of an n word dividend by a one word divisor. The quotient is placed into quotient. The one word divisor is specified by divisor. The value of this MutableBigInteger is the dividend at invocation but is replaced by the remainder. NOTE: The value of this MutableBigInteger is modified by this method.



euclidModInverse
MutableBigInteger euclidModInverse(int k)(Code)
Uses the extended Euclidean algorithm to compute the modInverse of base mod a modulus that is a power of 2. The modulus is 2^k.



fixup
static MutableBigInteger fixup(MutableBigInteger c, MutableBigInteger p, int k)(Code)



hybridGCD
MutableBigInteger hybridGCD(MutableBigInteger b)(Code)
Calculate GCD of this and b. This and b are changed by the computation.



inverseMod32
static int inverseMod32(int val)(Code)



isEven
boolean isEven()(Code)
Returns true iff this MutableBigInteger is even.



isNormal
boolean isNormal()(Code)
Returns true iff this MutableBigInteger is in normal form. A MutableBigInteger is in normal form if it has no leading zeros after the offset, and intLen + offset <= value.length.



isOdd
boolean isOdd()(Code)
Returns true iff this MutableBigInteger is odd.



isOne
boolean isOne()(Code)
Returns true iff this MutableBigInteger has a value of one.



isZero
boolean isZero()(Code)
Returns true iff this MutableBigInteger has a value of zero.



leftShift
void leftShift(int n)(Code)
Left shift this MutableBigInteger n bits.



modInverseBP2
static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k)(Code)



modInverseMP2
MutableBigInteger modInverseMP2(int k)(Code)



mul
void mul(int y, MutableBigInteger z)(Code)
Multiply the contents of this MutableBigInteger by the word y. The result is placed into z.



multiply
void multiply(MutableBigInteger y, MutableBigInteger z)(Code)
Multiply the contents of two MutableBigInteger objects. The result is placed into MutableBigInteger z. The contents of y are not changed.



mutableModInverse
MutableBigInteger mutableModInverse(MutableBigInteger p)(Code)
Returns the modInverse of this mod p. This and p are not affected by the operation.



normalize
final void normalize()(Code)
Ensure that the MutableBigInteger is in normal form, specifically making sure that there are no leading zeros, and that if the magnitude is zero, then intLen is zero.



reset
void reset()(Code)
Set a MutableBigInteger to zero, removing its offset.



rightShift
void rightShift(int n)(Code)
Right shift this MutableBigInteger n bits. The MutableBigInteger is left in normal form.



setInt
void setInt(int index, int val)(Code)
Sets the int at index+offset in this MutableBigInteger to val. This does not get inlined on all platforms so it is not used as often as originally intended.



setValue
void setValue(int[] val, int length)(Code)
Sets this MutableBigInteger's value array to the specified array. The intLen is set to the specified length.



subtract
int subtract(MutableBigInteger b)(Code)
Subtracts the smaller of this and b from the larger and places the result into this MutableBigInteger.



toIntArray
int[] toIntArray()(Code)
Convert this MutableBigInteger into an int array with no leading zeros, of a length that is equal to this MutableBigInteger's intLen.



toString
public String toString()(Code)
Returns a String representation of this MutableBigInteger in radix 10.



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.