Here you can find the source of listFiles(File dir)
public static List<File> listFiles(File dir)
//package com.java2s; import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { public static List<File> listFiles(File dir) { List<File> list = new ArrayList<File>(); if (dir.exists()) { for (File f : dir.listFiles()) { if (f.isFile()) { list.add(f);/* w w w . j av a2 s.com*/ } } } return list; } }