All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Acme.Primes

java.lang.Object
   |
   +----Acme.Primes

public class Primes
extends Object
implements Enumeration
An enumerator yielding prime numbers.

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.


Constructor Index

 o Primes(long, long)

Method Index

 o hasMoreElements()
 o isPrime(long)
 o nextElement()
 o nextElementL()

Constructors

 o Primes
 public Primes(long from,
               long to)

Methods

 o hasMoreElements
 public boolean hasMoreElements()
 o nextElement
 public Object nextElement()
 o nextElementL
 public long nextElementL()
 o isPrime
 public synchronized boolean isPrime(long n)

All Packages  Class Hierarchy  This Package  Previous  Next  Index

ACME Java  ACME Labs