@Override
        public boolean accept(File f) {
            if (f.isDirectory()) {
                return true;
            }

            String s = f.getPath();

            int i = s.lastIndexOf('.');

            if (!(i > 0 && i < s.length() - 1)) {
                return false;
            }

            String extension = s.substring(i + 1).toLowerCase();

            for (String ext : extensions) {
                if (extension.equals(ext)) {
                    return true;
                }
            }

            return false;
        }