title: how to extract only audio files and put them in an arrayList
body: <p>I am writing a program where i want all my audio files (.mp3,.wav etc ) files in an arrayList
  my code looks like this:</p>
  
  <pre><code>public class FileTest
  {
  
      public ArrayList&lt;File&gt; list(String directoryName, ArrayList&lt;File&gt; files)
      {
          File directory = new File(directoryName);
          File[] fList = directory.listFiles();
          for (File file : fList) {
              if (file.isFile() **&amp;&amp; (if the file is an audio file)**) {
                  files.add(file);
              } else if (file.isDirectory()) {
                  list(file.getAbsolutePath(), files);
              }
  
          }
  
          return files;
      }
  
      public static void main(String[] args)
      {
          FileTest fileTest = new FileTest();
  
          ArrayList&lt;File&gt; files = new ArrayList&lt;File&gt;();
  
          files = fileTest.list("/media/kumuda/D804C38204C361DC/Program Files",files);
  
          for(File file : files)
          {
              System.out.println(file.getAbsolutePath());
          }
      }
  }
  </code></pre>
  
  <p>I want to check if the file is an audio file before adding it to my arraylist.
  I searched for api's and came across Apache Tika library. 
  but i am not getting how it exactly works.
  Please can anyone help me ?</p>