title: find specific file type from folder and its sub folder
body: <p>I am writing a method to get specific file type such as pdf or txt from folders and subfolders but I am lacking to solve this problem. here is my code </p>
  
  <pre><code>  // .............list file
      File directory = new File(directoryName);
  
      // get all the files from a directory
      File[] fList = directory.listFiles();
  
      for (File file : fList) {
          if (file.isFile()) {
              System.out.println(file.getAbsolutePath());
          } else if (file.isDirectory()) {
              listf(file.getAbsolutePath());
          }
      }
  </code></pre>
  
  <p>My current method list all files but I need specific files</p>