Here you can find the source of getFilesByType(String path, final String type)
public static File[] getFilesByType(String path, final String type)
//package com.java2s; import java.io.File; import java.io.FileFilter; public class Main { public static File[] getFilesByType(String path, final String type) { File dir = new File(path); File[] files = dir.listFiles(new FileFilter() { public boolean accept(File afile) { return afile.getName().endsWith(type) && afile.isFile(); }// ww w. ja v a2 s . co m }); return files == null ? new File[] {} : files; } }