private static List<String> calculateBundleNames(String baseName,Locale locale){
  final List<String> result=new ArrayList<String>(3);
  final String language=locale.getLanguage();
  final int languageLength=language.length();
  final String country=locale.getCountry();
  final int countryLength=country.length();
  final String variant=locale.getVariant();
  final int variantLength=variant.length();
  result.add(0,baseName);
  if (languageLength + countryLength + variantLength == 0) {
    return result;
  }
  final StringBuilder temp=new StringBuilder(baseName);
  temp.append('_');
  temp.append(language);
  if (languageLength > 0) {
    result.add(0,temp.toString());
  }
  if (countryLength + variantLength == 0) {
    return result;
  }
  temp.append('_');
  temp.append(country);
  if (countryLength > 0) {
    result.add(0,temp.toString());
  }
  if (variantLength == 0) {
    return result;
  }
  temp.append('_');
  temp.append(variant);
  result.add(0,temp.toString());
  return result;
}

private static List < String > calculateBundleNames ( String baseName , Locale locale ) { final List < String > result = new ArrayList < String > ( 3 ) ; final String language = locale . getLanguage ( ) ; final int languageLength = language . length ( ) ; final String country = locale . getCountry ( ) ; final int countryLength = country . length ( ) ; final String variant = locale . getVariant ( ) ; final int variantLength = variant . length ( ) ; result . add ( 0 , baseName ) ; if ( languageLength + countryLength + variantLength == 0 ) { return result ; } final StringBuilder temp = new StringBuilder ( baseName ) ; temp . append ( '_' ) ; temp . append ( language ) ; if ( languageLength > 0 ) { result . add ( 0 , temp . toString ( ) ) ; } if ( countryLength + variantLength == 0 ) { return result ; } temp . append ( '_' ) ; temp . append ( country ) ; if ( countryLength > 0 ) { result . add ( 0 , temp . toString ( ) ) ; } if ( variantLength == 0 ) { return result ; } temp . append ( '_' ) ; temp . append ( variant ) ; result . add ( 0 , temp . toString ( ) ) ; return result ; }
copied from java . util . resourcebundle implementation
