Here you can find the source of getFileList(String path, String filterName)
public static File[] getFileList(String path, String filterName)
//package com.java2s; import java.io.*; import java.util.*; public class Main { public static File[] getFileList(String path, String filterName) { List<File> fileList = new ArrayList<File>(); File[] files = new File(path).listFiles(); if (!filterName.equals("") && filterName != null) { for (File file : files) { if (file.isDirectory()) { continue; }/* www . j ava 2 s . c o m*/ if (file.getName().endsWith(filterName)) { fileList.add(file); } } } else { for (File file : files) { if (file.isDirectory()) { continue; } fileList.add(file); } } File[] resultFileList = null; if (fileList != null && fileList.size() > 0) { resultFileList = new File[fileList.size()]; for (int i = 0; i < fileList.size(); i++) { resultFileList[i] = fileList.get(i); } } return resultFileList; } }