class FileHelper {

    public static File findFile(String file, String rootPath) {
        if (rootPath == null || "".equals(rootPath)) {
            return null;
        }
        File result = null;
        Collection<File> fileCollection = FileUtils.listFiles(new File(rootPath), new String[]{file.substring(file.lastIndexOf('.') + 1)}, true);
        if (fileCollection.isEmpty()) {
            return result;
        }
        Iterator<File> fileCollectionIterator = fileCollection.iterator();
        while (fileCollectionIterator.hasNext()) {
            File testFile = fileCollectionIterator.next();
            if (file.equals(testFile.getName())) {
                result = testFile;
            }
        }
        return result;
    }

}