Here you can find the source of getFiles(File dir)
public static File[] getFiles(File dir) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { public static File[] getFiles(File dir) throws IOException { if (dir.isFile()) throw new IOException("BadInputException: not a directory."); if (!dir.exists()) { throw new IOException(" don't exist "); }//from w w w. ja va 2 s .c om File[] files = dir.listFiles(); return files; } }