private static long getMillisecondCount(int unit, int count) {

        switch (unit) {
            case (YEAR):
                return (365L * 24L * 60L * 60L * 1000L) * count;
            case (MONTH):
                return (31L * 24L * 60L * 60L * 1000L) * count;
            case (DAY):
                return (24L * 60L * 60L * 1000L) * count;
            case (HOUR):
                return (60L * 60L * 1000L) * count;
            case (MINUTE):
                return (60L * 1000L) * count;
            case (SECOND):
                return 1000L * count;
            case (MILLISECOND):
                return count;
            default:
                throw new IllegalArgumentException(
                    "DateTickUnit.getMillisecondCount() : unit must "
                    + "be one of the constants YEAR, MONTH, DAY, HOUR, MINUTE, "
                    + "SECOND or MILLISECOND defined in the DateTickUnit "
                    + "class. Do *not* use the constants defined in "
                    + "java.util.Calendar."
                );
        }

    }