question: private static int compareLocales ( Locale primary , Locale other ) { final String lang = primary . getLanguage ( ) ; if ( ( lang == null ) || ! lang . equals ( other . getLanguage ( ) ) ) { return 0 ; } final String country = primary . getCountry ( ) ; if ( ( country == null ) || ! country . equals ( other . getCountry ( ) ) ) { return 1 ; } final String variant = primary . getVariant ( ) ; if ( ( variant == null ) || ! variant . equals ( other . getVariant ( ) ) ) { return 2 ; } return 3 ; }
target:  Compares a locale against a primary locale. Returns higher values for closer matches. A return value of 3 indicates that the locale is an exact match for the primary locale's language, country, and variant.