@@ -0,0 +1,2138 @@
+import java.io.*;%0Aimport static java.lang.System.*;%0Aimport java.util.*;%0Aimport java.util.ArrayList;%0Aimport java.util.Scanner;%0Aclass prime %7B%0A public static void main (String str%5B%5D) %7B%0A   Scanner scan = new Scanner ( System.in );%0A   System.out.println(%22This program finds the largest prime number small than a given number%22);%0A   System.out.println(%22What is the largest number to be considered?%22);%0A   long maxno = scan.nextLong();%0A   if ( maxno %3C 3 ) %7B%0A     System.out.println(%22The minimum useable number is 3%22);%0A     exit(0);%0A   %7D%0A   Date sdate = new Date();%0A   System.out.println(%22Finding the largest prime number smaller than %22 + maxno );%0A   ArrayList%3CLong%3E numbers = new ArrayList%3CLong%3E();%0A   numbers.add((long) 2);%0A   for ( long i = 3; i %3C= maxno; i+=2) %7B%0A     numbers.add(i);%0A   %7D%0A   System.out.println(%22Numbers range from %22 + numbers.get(0) + %22 to %22+  numbers.get(numbers.size() - 1));%0A   %0A   ArrayList%3CLong%3E result = new ArrayList%3CLong%3E();%0A   while ( numbers.size() %3E 0 ) %7B%0A     result.add(numbers.get(0));%0A     long curr = (long) numbers.get(0);%0A     for ( int n=numbers.size() - 1; n%3E=0; n--) %7B%0A       if ( numbers.get(n) %25 curr == 0 ) %7B%0A         numbers.remove(n);%0A       %7D%0A     %7D%0A  %7D%0A  System.out.println(result.get(result.size() - 1) + %22 is a prime number%22);%0A  if ( result.get(result.size() - 1) %3C maxno ) %7B%0A    System.out.println(%22There are %22 + result.size() + %22 prime numbers smaller than %22 + maxno);%0A  %7D else %7B%0A    System.out.println(%22There are %22 + result.size() + %22 prime numbers up to, and including %22 + maxno);%0A  %7D%0A  Date edate = new Date();%0A  System.out.println(%22Start time%5Ct%22 + sdate.toString());%0A  System.out.println(%22End time%5Ct%22 + edate.toString());%0A  System.out.println(%22Searching for prome pairs%22);%0A  int i = 1;%0A  int pp=0;%0A  long lpp=0;%0A  while ( i %3C result.size() ) %7B%0A    if ( result.get(i) == result.get(i - 1) +2 ) %7B%0A      /* System.out.println(result.get(i - 1) + %22 and %22 + result.get(i) + %22 are a prime pair%22); */%0A      pp++;%0A      lpp=result.get(i);%0A    %7D%0A    i++;%0A  %7D%0A  System.out.println(%22We discovered %22 + pp + %22 prime pairs%22);%0A  System.out.println(%22Last Prime Pair was %22 + lpp + %22 and %22 + (lpp - 2));%0A %7D%0A%7D%0A

Create prime.java