public class PrintPrimes {
  static final int M = 300;
  static final int RR = 50;
  static final int CC = 4;
  static final int WW = 10;
  static final int ORDMAX = 30;
  static int P[] = new int[M + 1];

  public static void main(String[] args) {
      calculatePrimes();
      printPrimes();
  }

  public static void calculatePrimes() {
      boolean JPRIME;
      int N;
      int MULT[] = new int[ORDMAX + 1];

      int J = 1;
      int K = 1;
      P[1] = 2;
      int ORD = 2;
      int SQUARE = 9;

      while (K < M) {
        do {
          J = J + 2;
          if (J == SQUARE) {
            ORD = ORD + 1;
            SQUARE = P[ORD] * P[ORD];
            MULT[ORD - 1] = J;
          }
          N = 2;
          JPRIME = true;
          while (N < ORD && JPRIME) {
            while (MULT[N] < J)
              MULT[N] = MULT[N] + P[N] + P[N];
            if (MULT[N] == J)
              JPRIME = false;
            N = N + 1;
          }
        } while (!JPRIME);
        K = K + 1;
        P[K] = J;
      }
    }

    public static void printPrimes() {
        int PAGENUMBER = 1;
        int PAGEOFFSET = 1;
        while (PAGEOFFSET <= M) {
          System.out.println("The First " + M +
                               " Prime Numbers --- Page " + PAGENUMBER);
          System.out.println("");
          for (int ROWOFFSET = PAGEOFFSET; ROWOFFSET < PAGEOFFSET + RR; ROWOFFSET++){
            for (int C = 0; C < CC;C++)
              if (ROWOFFSET + C * RR <= M)
                System.out.format("%10d", P[ROWOFFSET + C * RR]);
            System.out.println("");
          }
          System.out.println("\f");
          PAGENUMBER = PAGENUMBER + 1;
          PAGEOFFSET = PAGEOFFSET + RR * CC;
        }
    }
}

					 

@@ -26,136 +26,221 @@
 %7B%0A  
-static final int M = 300
+int M;%0A  int RR;%0A  int CC;%0A  int WW;%0A  int ORDMAX;%0A  int P%5B%5D
 ;%0A
+%0A
   
-static final int RR = 50
+public PrintPrimes(int M, int RR, int CC, int WW, int ORDMAX) %7B%0A    this.M   = M
 ;%0A  
-static final int 
+  this.RR  = RR;%0A    this.
 CC 
+ 
 = 
-4
+CC
 ;%0A  
-static final int 
+  this.
 WW 
+ 
 = 
-10
+WW
 ;%0A  
-static final int 
+  this.
 ORDM
@@ -248,28 +248,26 @@
 X = 
-30
+ORDMAX
 ;%0A  
-static int P%5B%5D
+  this.P
  = n
@@ -281,16 +281,21 @@
 M + 1%5D;%0A
+  %7D%0A%0A
 %0A  publi
@@ -336,16 +336,97 @@
 %7B%0A      
+PrintPrimes printPrimes = new PrintPrimes(300, 50, 4, 10, 30);%0A      printPrimes.
 calculat
@@ -434,32 +434,44 @@
 Primes();%0A      
+printPrimes.
 printPrimes();%0A 
@@ -479,31 +479,24 @@
 %7D%0A%0A  public 
-static 
 void calcula
@@ -1209,31 +1209,24 @@
 %0A    public 
-static 
 void printPr

Remove static fields