Java Doc for Division.java in  » Apache-Harmony-Java-SE » java-package » 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 » Apache Harmony Java SE » java package » java.math 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.math.Division

Division
class Division (Code)
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:
author:
   Intel Middleware Product Division
author:
   Instituto Tecnologico de Cordoba




Method Summary
static  int[]divide(int quot, int quotLength, int a, int aLength, int b, int bLength)
     Divides the array 'a' by the array 'b' and gets the quotient and the remainder.
static  BigInteger[]divideAndRemainderByInteger(BigInteger val, int divisor, int divisorSign)
     Computes the quotient and the remainder after a division by an int number.
static  intdivideArrayByInt(int dest, int src, int srcLength, int divisor)
     Divides an array by an integer value.
static  longdivideLongByInt(long a, int b)
     Divides an unsigned long a by an unsigned int b.
static  BigIntegerevenModPow(BigInteger base, BigInteger exponent, BigInteger modulus)
     Performs modular exponentiation using the Montgomery Reduction.
static  BigIntegerfinalSubtraction(int t, int tLength, int s, BigInteger modulus)
    
static  BigIntegergcdBinary(BigInteger op1, BigInteger op2)
    
static  longgcdBinary(long op1, long op2)
     Performs the same as Division.gcdBinary(BigInteger,BigInteger) , but with numbers of 63 bits, represented in positives values of long type.
static  voidinplaceModPow2(BigInteger x, int n)
     Performs x = x mod (2n) .
static  BigIntegermodInverseLorencz(BigInteger a, BigInteger modulo)
     Based on "New Algorithm for Classical Modular Inverse" Róbert Lórencz.
static  BigIntegermodInverseMontgomery(BigInteger a, BigInteger p)
    
static  BigIntegermodPow2Inverse(BigInteger x, int n)
    
Parameters:
  x - an odd positive number.
Parameters:
  n - the exponent by which 2 is raised.
static  BigIntegermonPro(BigInteger a, BigInteger b, BigInteger modulus, long n2)
     Implements the Montgomery Product of two integers represented by int arrays.
static  BigIntegermonSquare(BigInteger aBig, BigInteger modulus, long n2)
     Implements the Montgomery Square of a BigInteger.
static  intmultiplyAndSubtract(int a, int start, int b, int bLen, long c)
     Multiplies an array by int and subtracts it from a subarray of another array.
static  BigIntegeroddModPow(BigInteger base, BigInteger exponent, BigInteger modulus)
     Performs modular exponentiation using the Montgomery Reduction.
static  BigIntegerpow2ModPow(BigInteger base, BigInteger exponent, int j)
     It requires that all parameters be positive.
static  intremainder(BigInteger dividend, int divisor)
     Divides a BigInteger by a signed int and returns the remainder.
Parameters:
  dividend - the BigInteger to be divided.
static  intremainderArrayByInt(int src, int srcLength, int divisor)
     Divides an array by an integer value.
static  BigIntegerslidingWindow(BigInteger x2, BigInteger a2, BigInteger exponent, BigInteger modulus, long n2)
    
static  BigIntegersquareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent, BigInteger modulus, long n2)
    



Method Detail
divide
static int[] divide(int quot, int quotLength, int a, int aLength, int b, int bLength)(Code)
Divides the array 'a' by the array 'b' and gets the quotient and the remainder. Implements the Knuth's division algorithm. See D. Knuth, The Art of Computer Programming, vol. 2. Steps D1-D8 correspond the steps in the algorithm description.
Parameters:
  quot - the quotient
Parameters:
  quotLength - the quotient's length
Parameters:
  a - the dividend
Parameters:
  aLength - the dividend's length
Parameters:
  b - the divisor
Parameters:
  bLength - the divisor's length the remainder



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



divideArrayByInt
static int divideArrayByInt(int dest, int src, int srcLength, int divisor)(Code)
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
Parameters:
  src - the dividend
Parameters:
  srcLength - the length of the dividend
Parameters:
  divisor - the divisor remainder



divideLongByInt
static long divideLongByInt(long a, int b)(Code)
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
Parameters:
  b - the divisor the long value containing the unsigned integer remainder in theleft half and the unsigned integer quotient in the right half



evenModPow
static BigInteger evenModPow(BigInteger base, BigInteger exponent, BigInteger modulus)(Code)
Performs modular exponentiation using the Montgomery Reduction. It requires that all parameters be positive and the modulus be even. Based The square and multiply algorithm and the Montgomery Reduction C. K. Koc - Montgomery Reduction with Even Modulus. The square and multiply algorithm and the Montgomery Reduction.
See Also:   BigInteger.modPow(BigIntegerBigInteger)



finalSubtraction
static BigInteger finalSubtraction(int t, int tLength, int s, BigInteger modulus)(Code)



gcdBinary
static BigInteger gcdBinary(BigInteger op1, BigInteger op2)(Code)

Parameters:
  m - a positive modulusReturn the greatest common divisor of op1 and op2,
Parameters:
  op1 - must be greater than zero
Parameters:
  op2 - must be greater than zero
See Also:   BigInteger.gcd(BigInteger) GCD(op1, op2)



gcdBinary
static long gcdBinary(long op1, long op2)(Code)
Performs the same as Division.gcdBinary(BigInteger,BigInteger) , but with numbers of 63 bits, represented in positives values of long type.
Parameters:
  op1 - a positive number
Parameters:
  op2 - a positive number
See Also:   Division.gcdBinary(BigInteger,BigInteger) GCD(op1, op2)



inplaceModPow2
static void inplaceModPow2(BigInteger x, int n)(Code)
Performs x = x mod (2n) .
Parameters:
  x - a positive number, it will store the result.
Parameters:
  n - a positive exponent of 2 .



modInverseLorencz
static BigInteger modInverseLorencz(BigInteger a, BigInteger modulo)(Code)
Based on "New Algorithm for Classical Modular Inverse" Róbert Lórencz. LNCS 2523 (2002) a^(-1) mod m



modInverseMontgomery
static BigInteger modInverseMontgomery(BigInteger a, BigInteger p)(Code)
Calculates a.modInverse(p) Based on: Savas, E; Koc, C "The Montgomery Modular Inverse - Revised"



modPow2Inverse
static BigInteger modPow2Inverse(BigInteger x, int n)(Code)

Parameters:
  x - an odd positive number.
Parameters:
  n - the exponent by which 2 is raised. x-1 (mod 2n) .



monPro
static BigInteger monPro(BigInteger a, BigInteger b, BigInteger modulus, long n2)(Code)
Implements the Montgomery Product of two integers represented by int arrays. The arrays are supposed in little endian notation.
Parameters:
  a - The first factor of the product.
Parameters:
  b - The second factor of the product.
Parameters:
  modulus - The modulus of the operations. Zmodulus.
Parameters:
  n2 - The digit modulus'[0].
See Also:   Division.modPowOdd(BigInteger,BigInteger,BigInteger)



monSquare
static BigInteger monSquare(BigInteger aBig, BigInteger modulus, long n2)(Code)
Implements the Montgomery Square of a BigInteger.
See Also:   Division.monPro(BigInteger,BigInteger,BigInteger,long)



multiplyAndSubtract
static int multiplyAndSubtract(int a, int start, int b, int bLen, long c)(Code)
Multiplies an array by int and subtracts it from a subarray of another array.
Parameters:
  a - the array to subtract from
Parameters:
  start - the start element of the subarray of a
Parameters:
  b - the array to be multiplied and subtracted
Parameters:
  bLen - the length of b
Parameters:
  c - the multiplier of b the carry element of subtraction



oddModPow
static BigInteger oddModPow(BigInteger base, BigInteger exponent, BigInteger modulus)(Code)
Performs modular exponentiation using the Montgomery Reduction. It requires that all parameters be positive and the modulus be odd. >
See Also:   BigInteger.modPow(BigIntegerBigInteger)
See Also:   Division.monPro(BigInteger,BigInteger,BigInteger,long)
See Also:   Division.slidingWindow(BigInteger,BigInteger,BigInteger,BigInteger,long)
See Also:   Division.squareAndMultiply(BigInteger,BigInteger,BigInteger,BigInteger,long)



pow2ModPow
static BigInteger pow2ModPow(BigInteger base, BigInteger exponent, int j)(Code)
It requires that all parameters be positive. baseexponent mod (2j) .
See Also:   BigInteger.modPow(BigIntegerBigInteger)



remainder
static int remainder(BigInteger dividend, int divisor)(Code)
Divides a BigInteger by a signed int and returns the remainder.
Parameters:
  dividend - the BigInteger to be divided. Must be non-negative.
Parameters:
  divisor - a signed int divide % divisor



remainderArrayByInt
static int remainderArrayByInt(int src, int srcLength, int divisor)(Code)
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
Parameters:
  srcLength - the length of the dividend
Parameters:
  divisor - the divisor remainder



slidingWindow
static BigInteger slidingWindow(BigInteger x2, BigInteger a2, BigInteger exponent, BigInteger modulus, long n2)(Code)



squareAndMultiply
static BigInteger squareAndMultiply(BigInteger x2, BigInteger a2, BigInteger exponent, BigInteger modulus, long n2)(Code)



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.