From 47abbc97a47b816921ea725ad9a72240c22c41f4 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 13 Oct 2019 13:46:46 -0500 Subject: Finish lab (rather easy) --- csci1913/Java/lab5_strap012.java | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'csci1913/Java') diff --git a/csci1913/Java/lab5_strap012.java b/csci1913/Java/lab5_strap012.java index f7f9467..45a101b 100644 --- a/csci1913/Java/lab5_strap012.java +++ b/csci1913/Java/lab5_strap012.java @@ -10,10 +10,35 @@ // // Put your code for the class SIEVE here!!! // -class sieve { - - public sieve(){ - for +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