BigInteger
| Modifier and Type | Field and Description |
|---|---|
| private final long[] | bits
Stores the bits in this bitSieve. |
| private final int | length
Length is how many bits this sieve holds. |
| private static final BitSieve | smallSieve
A small sieve used to filter out multiples of small primes in a search sieve. |
| Access | Constructor and Description |
|---|---|
| private | |
| pack-priv | BitSieve(BigInteger base, int searchLen)
Construct a bit sieve of searchLen bits used for finding prime number candidates. |
| Modifier and Type | Method and Description |
|---|---|
| private static long | |
| private boolean | |
| pack-priv BigInteger | retrieve(BigInteger initValue, int certainty, Random random)
Test probable primes in the sieve and return successful candidates. |
| private void | |
| private int | sieveSearch(int limit, int start)
This method returns the index of the first clear bit in the search array that occurs at or after start. |
| private void | |
| private static int |
| bits | back to summary |
|---|---|
| private final long[] bits Stores the bits in this bitSieve. | |
| length | back to summary |
|---|---|
| private final int length Length is how many bits this sieve holds. | |
| smallSieve | back to summary |
|---|---|
| private static final BitSieve smallSieve A small sieve used to filter out multiples of small primes in a search sieve. | |
| BitSieve | back to summary |
|---|---|
| private BitSieve() Construct a "small sieve" with a base of 0. This constructor is used internally to generate the set of "small primes" whose multiples are excluded from sieves generated by the main (package private) constructor, BitSieve(BigInteger base, int searchLen). The length of the sieve generated by this constructor was chosen for performance; it controls a tradeoff between how much time is spent constructing other sieves, and how much time is wasted testing composite candidates for primality. The length was chosen experimentally to yield good performance. | |
| BitSieve | back to summary |
|---|---|
| pack-priv BitSieve(BigInteger base, int searchLen) Construct a bit sieve of searchLen bits used for finding prime number candidates. The new sieve begins at the specified base, which must be even. | |
| bit | back to summary |
|---|---|
| private static long bit(int bitIndex) Return a unit that masks the specified bit in its unit. | |
| get | back to summary |
|---|---|
| private boolean get(int bitIndex) Get the value of the bit at the specified index. | |
| retrieve | back to summary |
|---|---|
| pack-priv BigInteger retrieve(BigInteger initValue, int certainty, Random random) Test probable primes in the sieve and return successful candidates. | |
| set | back to summary |
|---|---|
| private void set(int bitIndex) Set the bit at the specified index. | |
| sieveSearch | back to summary |
|---|---|
| private int sieveSearch(int limit, int start) This method returns the index of the first clear bit in the search array that occurs at or after start. It will not search past the specified limit. It returns -1 if there is no such clear bit. | |
| sieveSingle | back to summary |
|---|---|
| private void sieveSingle(int limit, int start, int step) Sieve a single set of multiples out of the sieve. Begin to remove multiples of the specified step starting at the specified start index, up to the specified limit. | |
| unitIndex | back to summary |
|---|---|
| private static int unitIndex(int bitIndex) Given a bit index return unit index containing it. | |