-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
31 lines (25 loc) · 826 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/** For testing Primes class. */
public class Main {
/** Main for testing Primes class. */
public static void main(String[] args) {
showInitPrimes();
showNextPrime();
}
/** Show how to initialize Primes class. */
public static void showInitPrimes() {
// Initialize to contain all primes up to 128
Primes primes = new Primes(128);
primes.printBitmap();
}
/** Shows how to grab next primes in sequence. */
public static void showNextPrime() {
Primes primes = new Primes(); // Initialize empty primes.
primes.printBitmap(); // Display empty bitmap
// Print the first 64 primes
System.out.println("The first 64 primes:");
for (int i = 0; i < 64; i++) {
System.out.println("\tPrime #" + (i + 1) + ": " + primes.nextPrime());
}
primes.printBitmap(); // Bitmap of first 24 primes
}
}