Files2 { public static boolean acceptByLowerCaseExtension(File pathname, String... lowerCaseExtensions) { String ext = Files.getFileExtension(pathname.getName()).toLowerCase(Locale.ENGLISH); for (String o : lowerCaseExtensions) { if (ext.equals(o)) { return true; } } return false; } private  Files2(); static File fromPath(String parent, String... path); @Deprecated static boolean isValidPath(File file); @Nullable static File getAbsoluteFile(@NonNull File[] paths, @NonNull File file); @Nullable static File getRelativeFile(@NonNull File[] paths, @NonNull File file); static boolean acceptByLowerCaseExtension(File pathname, String... lowerCaseExtensions); @Nullable static File extractFile(@NonNull String path);  }
@Test public void testAcceptByExtension() { assertTrue(Files2.acceptByLowerCaseExtension(new File("hello.xml"), "xml")); assertTrue(Files2.acceptByLowerCaseExtension(new File("hello.xml"), "jpg", "xml")); assertTrue(Files2.acceptByLowerCaseExtension(new File("hello.xMl"), "xml")); assertFalse(Files2.acceptByLowerCaseExtension(new File("hello.xml"), "jpg")); assertFalse(Files2.acceptByLowerCaseExtension(new File("hello.xml"))); }