static private Month getLongestTextMonthInLocale(Locale locale, FontMetrics fontMetrics) {
        // Get the "formatting names" of all the months for this locale.
        // Request the capitalized long version of the translated month names.
        String[] formattingMonthNames = ExtraDateStrings.getFormattingMonthNamesArray(
                locale, true, false);
        // Find out which month is longest, using the supplied font metrics.
        int longestMonthWidth = 0;
        Month longestMonth = Month.JANUARY;
        for (int i = 0; i < formattingMonthNames.length; ++i) {
            int currentMonthWidth = fontMetrics.stringWidth(formattingMonthNames[i]);
            if (currentMonthWidth >= longestMonthWidth) {
                int oneBasedMonthIndex = (i + 1);
                longestMonth = Month.of(oneBasedMonthIndex);
                longestMonthWidth = currentMonthWidth;
            }
        }
        return longestMonth;
    }
static private Month getLongestTextMonthInLocale ( Locale locale , FontMetrics fontMetrics ) { String [ ] formattingMonthNames = ExtraDateStrings . getFormattingMonthNamesArray ( locale , true , false ) ; int longestMonthWidth = 0 ; Month longestMonth = Month . JANUARY ; for ( int i = 0 ; i < formattingMonthNames . length ; ++ i ) { int currentMonthWidth = fontMetrics . stringWidth ( formattingMonthNames [ i ] ) ; if ( currentMonthWidth >= longestMonthWidth ) { int oneBasedMonthIndex = ( i + 1 ) ; longestMonth = Month . of ( oneBasedMonthIndex ) ; longestMonthWidth = currentMonthWidth ; } } return longestMonth ; }
getLongestTextMonthInLocale,

For the supplied locale, this returns the month that has the longest translated, "formatting
version", "long text version" month name. The version of the month name string that is used
for comparison is further defined below.

Note that this does not return the longest month for numeric month date formats. The longest
month in entirely numeric formats is always December. (Month number 12).

The compared month names are the "formatting version" of the translated month names (not the
standalone version). In some locales such as Russian and Czech, the formatting version can be
different from the standalone version. The "formatting version" is the name of the month that
would be used in a formatted date. The standalone version is only used when the month is
displayed by itself.

The month names that are used for comparison are also the "long version" of the month names,
not the short (abbreviated) version.

The translated month names are compared using the supplied font metrics.

This returns the longest month, as defined by the above criteria. If two or more months are
"tied" as the "longest month", then the longest month that is closest to the end of the year
will be the one that is returned.