* @return
     */
    public static Sequence findMaxValueContigousSequence(int[] input) {
        Sequence curr = new Sequence();
        Sequence max = new Sequence();

        max.restart(1, 0);
        curr.restart(1, 0);

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

            if (sum < 0) {
                curr.restart(i + 2, 0);
                sum = 0;
            }
            else {
                if (input[i] > sum) {
                    // if the element is greater than the running sum then
                    // a new sequence is started from the current element.
                    curr.restart(i + 2, input[i]);
                }
                else {
                    // the current element is part of the sequence.
                    curr.extend(input[i]);
                }
            }

            if (curr.sum > max.sum) {
                // if the current running sum is greater than
                // the max then it becomes the maximum
                max.copy(curr);
            }
            else if (curr.sum == max.sum) {
                if (curr.end - curr.start > max.end - max.start) {
                    max.copy(curr);
                }
                else if (curr.end - curr.start == max.end - max.start) {
                    if (curr.start < max.start) {
                        max.copy(curr);
                    }
                }
            }
            if (SDA11101.DEBUG_MODE) {
                System.out.println("\n========\n");
                System.out.println("CURR [" + i + "] : " + curr);
                System.out.println("MAXX [" + i + "] : " + max);
                System.out.println("\n========\n");
            }
        }
        return max;
    }