import java.util.*;

public class XMAS
{
    public XMAS (boolean debug)
    {
        _debug = debug;
    }

    public Vector<Integer> validate (Vector<Integer> input, int preamble)
    {
        Vector<Integer> invalid = new Vector<Integer>();
        int index = 0;

        for (int i = preamble; i < input.size(); i++)
        {
            if (!sums(input.elementAt(i), input, index, preamble))
                invalid.add(input.elementAt(i));
            
            index++;
        }

        return invalid;
    }

    private boolean sums (int total, Vector<Integer> input, int start, int preamble)
    {
        for (int j = start; j < (start + preamble -1); j++)
        {
            if (input.elementAt(start) + input.elementAt(start +1) == total)
            {
                return true;
            }
        }

        if (_debug)
            System.out.println(total+" is not the sum of two entries.");

        return false;
    }

    private boolean _debug;
}
@@ -697,16 +697,94 @@
     if (
+_debug)%0A                System.out.println(%22Trying to total %22+total+%22 using %22+
 input.el
@@ -797,19 +797,25 @@
 t(start)
- + 
++%22 and %22+
 input.el
@@ -831,16 +831,78 @@
 tart +1)
+);%0A%0A            if (input.elementAt(j) + input.elementAt(j +1)
  == tota

Update XMAS.java