import java.io.*;

public class Intcode
{
    public enum OPCODE {
        ADD(1), MULTIPLY(2), HALT(99);

        OPCODE (int val)
        {
            this._val = val;
        }

        public int getVal ()
        {
            return _val;
        }

        private int _val;
    }

    public static final String DELIMITER = ",";

    public static void main (String[] args)
    {
        boolean debug = false;

        for (int i = 0; i < args.length; i++)
        {
            if ("-help".equals(args[i]))
            {
                System.out.println("[-help] [-verify] [-debug]");
                System.exit(0);
            }
            
            if ("-verify".equals(args[i]))
            {
                Intcode.verify();
                System.exit(0);
            }

            if ("-debug".equals(args[i]))
                debug = true;
        }

        BufferedReader reader = null;
        String[] values = null;

        try
        {
            reader = new BufferedReader(new FileReader(DATA_FILE));
            String line = null;

            while ((line = reader.readLine()) != null)
            {
                values = line.split(",");

                if (debug)
                {
                    for (String str : values)
                    {
                        System.out.println(str);
                    }
                }
            }
        }
        catch (Throwable ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();
            }
            catch (Throwable ex)
            {
            }
        }
    }

    private static void verify ()
    {

    }

    private static final String DATA_FILE = "instructions.txt";

    private static final String TEST_CODE_1 = "1,9,10,3,2,3,11,0,99,30,40,50";
    private static final String TEST_CODE_2 = "1,0,0,0,99";
    private static final String TEST_CODE_3 = "2,3,0,3,99";
    private static final String TEST_CODE_4 = "2,4,4,5,99,0";
    private static final String TEST_CODE_5 = "1,1,1,4,99,5,6,0,99";
}
@@ -43,251 +43,203 @@
     
-public enum OPCODE %7B%0A        ADD(1), MULTIPLY(2), HALT(99);%0A%0A        OPCODE (int val)%0A        %7B%0A            this._val = val;%0A        %7D%0A%0A        public int getVal ()%0A        %7B%0A            return _val;%0A        %7D%0A%0A        private int _val
+/*%0A     * Could be enum values but ints are just so much easier!%0A     */%0A%0A    public static final int ADD = 1;%0A    public static final int MULTIPLY = 2;%0A    public static final int HALT = 99
 ;%0A   
- %7D%0A
 %0A   
@@ -1323,32 +1323,98 @@
               %7D%0A
+                else%0A                    parseAndExecute(values);%0A
             %7D%0A  
@@ -1676,32 +1676,2087 @@
        %7D%0A    %7D%0A%0A
+    private static void parseAndExecute (String%5B%5D values)%0A    %7B%0A        for (int i = 0; i %3C values.length; i++)%0A        %7B%0A            String str = values%5Bi%5D;%0A%0A            switch (Integer.valueOf(str))%0A            %7B%0A                case Intcode.ADD:%0A                %7B%0A                    /*%0A                     * Opcode 1 adds together numbers read from two positions%0A                     * and stores the result in a third position. The three integers%0A                     * immediately after the opcode tell you these three positions - the%0A                     * first two indicate the positions from which you should read the%0A                     * input values, and the third indicates the position at which%0A                     * the output should be stored.%0A                     */%0A%0A                     int position1 = Integer.valueOf(values%5Bi+1%5D);%0A                     int position2 = Integer.valueOf(values%5Bi+2%5D);%0A                     int store = Integer.valueOf(values%5Bi+3%5D);%0A%0A                     int sum = Integer.valueOf(position1)+Integer.valueOf(position2);%0A%0A                     values%5Bstore%5D = String.valueOf(sum);%0A%0A                     i = i+3;  // move the pointer on.%0A                %7D%0A                break;%0A                case Intcode.MULTIPLY:%0A                %7B%0A                    /*%0A                     * Opcode 2 works exactly like opcode 1, except it multiplies the%0A                     * two inputs instead of adding them. Again, the three integers after%0A                     * the opcode indicate where the inputs and outputs are, not their values.%0A                     */%0A%0A                    int position1 = Integer.valueOf(values%5Bi+1%5D);%0A                    int position2 = Integer.valueOf(values%5Bi+2%5D);%0A                    int store = Integer.valueOf(values%5Bi+3%5D);%0A%0A                    int product = Integer.valueOf(position1)*Integer.valueOf(position2);%0A%0A                    values%5Bstore%5D = String.valueOf(product);%0A%0A                    i = i+3;  // move the pointer on.%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A
     private stat

Update Intcode.java