From 7a73162607544204032aa66cce755daf21edebda Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 24 May 2022 11:18:46 -0500 Subject: Graduate Signed-off-by: Matt Strapp --- csci1913/Java/lab5_strap012.java | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 csci1913/Java/lab5_strap012.java (limited to 'csci1913/Java/lab5_strap012.java') diff --git a/csci1913/Java/lab5_strap012.java b/csci1913/Java/lab5_strap012.java new file mode 100644 index 0000000..45a101b --- /dev/null +++ b/csci1913/Java/lab5_strap012.java @@ -0,0 +1,90 @@ +// +// SIEVE. The Sieve of Eratosthenes. +// +// James B. Moen +// 08 Oct 19 +// +// Test the SIEVE class, for 30 points total. +// + +// +// Put your code for the class SIEVE here!!! +// +class Sieve { + private boolean[] numbers; + private int realMax; + public Sieve(int max){ + if (max<2) + throw new IllegalArgumentException(); + numbers = new boolean[max]; + realMax = (max - 1); + for (int i=2; i