Code example for File

Methods: listFiles

    private static File getProfileDir(final File aRoot, final String aProfileName)
            throws IllegalArgumentException { 
        if (aRoot == null)
            throw new IllegalArgumentException("Invalid root directory");
        File[] profiles = aRoot.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                return pathname.getName().endsWith("." + aProfileName);
        if (profiles != null && profiles.length > 0)
            return profiles[0];
        return null; 
    private static File ensureMozillaDirectory(final Context aContext)
            throws IOException, IllegalArgumentException { 
        if (aContext == null)
            throw new IllegalArgumentException("Must provide a valid context");
Connect your IDE to all the code out there  Get Codota for Java