Here you can find the source of getFiles(File parentDir)
public static List<File> getFiles(File parentDir)
//package com.java2s; import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { public static List<File> getFiles(File parentDir) { List<File> fileList = new ArrayList<>(); File[] files = parentDir.listFiles(); if (files != null) { for (File file : files) { if (file.isFile()) { fileList.add(file);// w w w. j a va 2s. c om } } } return fileList; } }