public ArrayList<Interval> merge(Interval x, Interval y) {
        Interval small, big;
        ArrayList<Interval> result = new ArrayList<Interval>();
        if (x.start < y.start) {
            small = x;
            big = y;
        } else {
            small = y;
            big = x;
        }

        if (big.start > small.end) {
            //can't merge
            result.add(small);
            result.add(big);
        } else if (big.end < small.end) {
            //big is in small
            result.add(small);
        } else {
            Interval interval = new Interval(small.start, big.end);
            result.add(interval);
        }
        return result;

    }