title: File listing in Java. A fresh look
body: <p>The question is rather simple, but my brain boils :(((
  I know, that i should recursive function, but I can't organize it properely,
  because I'm limited by the types(it's a requirment)</p>
  
  <pre><code>public String[] getFiles(String initialDir) {}
  </code></pre>
  
  <p>First in my code I get the list of files and directories of initialDir
  then i go through the elements and look up for directories with the help of</p>
  
  <pre><code>.isDirectory()
  </code></pre>
  
  <p>and then I try to organize recursion, something like: </p>
  
  <pre><code>String [] buf = getFiles(Filelist[i].toString());
  </code></pre>
  
  <p>and here come troubles.</p>
  
  <p>The main problem is, determining the size of obtained data and allocating
  the necessary array of String [] type and further writing all recursion results
  and first-call results to the resulting array of String [] type.</p>
  
  <p>It really annoys me, so i need a fresh look from a side (maybe someone will help with
  code in the function).</p>
  
  <p>Thanks to all!</p>