public class Compute
{
    public static final int[] BASE_PATTERN = {0, 1, 0, -1};

    public Compute (boolean debug)
    {
        _debug = debug;
    }

    public int[] process (int[] input, int numberOfPhases)
    {
        int[] results = input;

        for (int i = 0; i < numberOfPhases; i++)
        {
            results = processPhase(phaseInput);

            phaseInput = results;
        }

        return results;
    }

    private int[] processPhase (int[] input)
    {
        int[] results = new int[input.length];
        int basePatternIndex = 0;
        int basePatternLowerBounds = 1;

        for (int i = 0; i < input.length; i++)
        {
            int[] work = new int[input.length];

            work[i] = input[i] * BASE_PATTERN[basePatternIndex];

            basePatternIndex++;

            if (basePatternIndex == BASE_PATTERN.length)
                basePatternIndex = basePatternLowerBounds;
        }

        return results;
    }

    boolean _debug;
}
@@ -366,16 +366,18 @@
         
+//
 phaseInp
@@ -654,32 +654,129 @@
  i++)%0A        %7B%0A
+            int value = 0;%0A%0A            for (int j = 0; j %3C input.length; j++)%0A            %7B%0A    
             int%5B
@@ -824,14 +824,18 @@
     
+   
+ 
 work%5B
-i
+j
 %5D = 
@@ -840,17 +840,17 @@
 = input%5B
-i
+j
 %5D * BASE
@@ -882,32 +882,36 @@
 %5D;%0A%0A            
+    
 basePatternIndex
@@ -915,16 +915,20 @@
 dex++;%0A%0A
+    
         
@@ -984,32 +984,36 @@
                 
+    
 basePatternIndex
@@ -1038,16 +1038,98 @@
 rBounds;
+%0A%0A                value += work%5Bj%5D;%0A            %7D%0A%0A            results%5Bi%5D = value;
 %0A       

Update Compute.java