From: stephey Date: Sat, 3 Apr 2010 01:40:53 +0000 (+0000) Subject: Renamed test.java to Test.java and updated makefile accordingly. Done to keep javac... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7242125bb42105259f1503c28b951ce9fd182cba;p=IRC.git Renamed test.java to Test.java and updated makefile accordingly. Done to keep javac from complaining --- diff --git a/Robust/src/Tests/mlp/stephen/test.java b/Robust/src/Tests/mlp/stephen/test.java deleted file mode 100644 index 421292f5..00000000 --- a/Robust/src/Tests/mlp/stephen/test.java +++ /dev/null @@ -1,65 +0,0 @@ -public class Test -{ - private final int MAX = 100000; - - public Test(){} - - public static void main(String args[]) { - - System.out.println("# it starts"); - Test t = new Test(); - t.doSomeWork(); - - } - - public void doSomeWork() - { - long sum = 0; - long time = System.currentTimeMillis(); - - //I did the for loop this way so that each parallel thread would take - //about the same time - for(int i = 0; i < MAX/2 + 1; i++) - { - int innerSum = 0; - - { - int oppositeNum = MAX - i; - - if(isPrime(i)) - innerSum += i; - - if(i != oppositeNum && isPrime(oppositeNum)) - innerSum += MAX - i; - } - - sum += innerSum; - } - - System.out.println("The sum of primes from 1 to " + MAX + " is " + sum + "."); - System.out.println("Note: 1 is counted as a prime."); - System.out.println("Time Consumed (Not Parallelized): " + (System.currentTimeMillis() - time) + " ms"); - - } - - - private boolean isPrime(int number) - { - //handles special cases - if(number < 1) - return false; - - if (number < 3) - return true; - - //Tests the rest of the numbers - for(int i = 2; i < number; i++) - { - if(number%i == 0) - return false; - } - - return true; - } - -}