lojix/power_model/src/main/com/thesett/aima/attribute/time/TimeUtils.java
private static int getMonthOfYear(long ticks, int year)
    {
        int i = (int) ((ticks - millisToYearStart(year)) >> 10);

        return (isLeapYear(year))
            ? ((i < (182 * MILLIS_PER_DAY_OVER_1024))
                ? ((i < (91 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (31 * MILLIS_PER_DAY_OVER_1024)) ? 1 : ((i < (60 * MILLIS_PER_DAY_OVER_1024)) ? 2 : 3))
                    : ((i < (121 * MILLIS_PER_DAY_OVER_1024)) ? 4 : ((i < (152 * MILLIS_PER_DAY_OVER_1024)) ? 5 : 6)))
                : ((i < (274 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (213 * MILLIS_PER_DAY_OVER_1024)) ? 7 : ((i < (244 * MILLIS_PER_DAY_OVER_1024)) ? 8 : 9))
                    : ((i < (305 * MILLIS_PER_DAY_OVER_1024)) ? 10
                                                              : ((i < (335 * MILLIS_PER_DAY_OVER_1024)) ? 11 : 12))))
            : ((i < (181 * MILLIS_PER_DAY_OVER_1024))
                ? ((i < (90 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (31 * MILLIS_PER_DAY_OVER_1024)) ? 1 : ((i < (59 * MILLIS_PER_DAY_OVER_1024)) ? 2 : 3))
                    : ((i < (120 * MILLIS_PER_DAY_OVER_1024)) ? 4 : ((i < (151 * MILLIS_PER_DAY_OVER_1024)) ? 5 : 6)))
                : ((i < (273 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (212 * MILLIS_PER_DAY_OVER_1024)) ? 7 : ((i < (243 * MILLIS_PER_DAY_OVER_1024)) ? 8 : 9))
                    : ((i < (304 * MILLIS_PER_DAY_OVER_1024)) ? 10
                                                              : ((i < (334 * MILLIS_PER_DAY_OVER_1024)) ? 11 : 12))));
    }
private static int getMonthOfYear(long ticks, int year)
    {
        int i = (int) ((ticks - millisToYearStart(year)) >> 10);

        return (isLeapYear(year))
            ? ((i < (182 * MILLIS_PER_DAY_OVER_1024))
                ? ((i < (91 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (31 * MILLIS_PER_DAY_OVER_1024)) ? 1 : ((i < (60 * MILLIS_PER_DAY_OVER_1024)) ? 2 : 3))
                    : ((i < (121 * MILLIS_PER_DAY_OVER_1024)) ? 4 : ((i < (152 * MILLIS_PER_DAY_OVER_1024)) ? 5 : 6)))
                : ((i < (274 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (213 * MILLIS_PER_DAY_OVER_1024)) ? 7 : ((i < (244 * MILLIS_PER_DAY_OVER_1024)) ? 8 : 9))
                    : ((i < (305 * MILLIS_PER_DAY_OVER_1024)) ? 10
                                                              : ((i < (335 * MILLIS_PER_DAY_OVER_1024)) ? 11 : 12))))
            : ((i < (181 * MILLIS_PER_DAY_OVER_1024))
                ? ((i < (90 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (31 * MILLIS_PER_DAY_OVER_1024)) ? 1 : ((i < (59 * MILLIS_PER_DAY_OVER_1024)) ? 2 : 3))
                    : ((i < (120 * MILLIS_PER_DAY_OVER_1024)) ? 4 : ((i < (151 * MILLIS_PER_DAY_OVER_1024)) ? 5 : 6)))
                : ((i < (273 * MILLIS_PER_DAY_OVER_1024))
                    ? ((i < (212 * MILLIS_PER_DAY_OVER_1024)) ? 7 : ((i < (243 * MILLIS_PER_DAY_OVER_1024)) ? 8 : 9))
                    : ((i < (304 * MILLIS_PER_DAY_OVER_1024)) ? 10
                                                              : ((i < (334 * MILLIS_PER_DAY_OVER_1024)) ? 11 : 12))));
    }
Given a millisecond timestamp that lands in a specified year, calculate what month the timestamp corresponds to.

@param  ticks The timestamp.
@param  year  The year that the timestamp falls in.

@return The month that the timestamp falls in, in the range 1 to 12.