### Question:
LanguageHelper { public static Locale getFilesLanguage(File f) throws IOException { Pattern patternFilenameIncludesLanguage = Pattern.compile(".*[-_](.+)$"); String ext = FilenameUtils.getExtension(f.getName()); String basename = FilenameUtils.getBaseName(f.getName()); Matcher m = patternFilenameIncludesLanguage.matcher(basename); if (m.matches()) { return Locale.forLanguageTag(m.group(1)); } else { throw new IOException("Cannot determine language of " + f + " please use the pattern filename-[language-tag].[ext]"); } }  static Locale getFilesLanguage(File f);  }### Answer:
@Test public void testGetName() throws Exception { Locale l = LanguageHelper.getFilesLanguage(new File("stereo-track.wav.48000Hz.128k.LC.2chan-zho.aac")); assertEquals("zho", l.getISO3Language()); l = LanguageHelper.getFilesLanguage(new File("stereo-track.wav.48000Hz.128k.LC.2chan-de.aac")); assertEquals("deu", l.getISO3Language()); l = LanguageHelper.getFilesLanguage(new File("stereo-track.wav.48000Hz.128k.LC.2chan-fr-FR.aac")); assertEquals("fra", l.getISO3Language()); }