class TimelineUtilities {

    public static TimeSpan getPrecedingMonths(Date reference, int months, boolean includeThisMonth)
    {
        Calendar gc = get0000(reference);
        gc.set(Calendar.DAY_OF_MONTH, 1);
        gc.add(Calendar.MONTH, includeThisMonth ? 1 - months : -months);
        long start = gc.getTimeInMillis();

        gc.add(Calendar.MONTH, months);
        Date tomorrowQuadZ = getNext0000(reference).getTime();
        if (gc.getTime().after(tomorrowQuadZ))
        {
            gc.setTime(tomorrowQuadZ);
        }
        long end = gc.getTimeInMillis();

        return TimeSpan.get(start, end);
    }

    private  TimelineUtilities();

}