All Packages Class Hierarchy This Package Previous Next Index
![]() |
java.lang.Object | +----Acme.Primes
Enumerates all the prime numbers in a given range.
Sample code:
Primes primes = new Acme.Primes( 1000, 2000 ); while ( primes.hasMoreElements() ) { // Get the next element as an Object: long prime = ((Long) primes.nextElement()).longValue(); // Or alternatively, as a long: long prime = primes.nextElementL(); // Then do whatever you like with prime. }
Fetch the software.
Fetch the entire Acme package.
public Primes(long from, long to)
public boolean hasMoreElements()
public Object nextElement()
public long nextElementL()
public synchronized boolean isPrime(long n)
All Packages Class Hierarchy This Package Previous Next Index
ACME Java ACME Labs