title: Finding last folder in list of folders
body: <p>Is there any faster method to find a folder that has no other folders inside?</p>
  
  <pre><code>File dir = new File("C:\\Users\\axs0552\\Desktop\\barcode\\");
  File[] cartella = dir.listFiles();
  
  List&lt;String&gt; Nome_cartela = null;
  if (cartella == null) {
      logger.debug("ERRORE: cartella inesistente, oppure directoy errata !!");
  } else {
      for (int i = 0; i &lt; cartella.length; i++) {
          if (cartella[i].isDirectory()) {
              System.out.println("cartella radice n° :" + i + " " + cartella[i].getName());
              File[] figli = cartella[i].listFiles();
              for (int j = 0; i &lt; figli.length; i++) {
                  if (figli[i].isDirectory()) {
                      System.out.println("cartella figlio n° :" + j + " " + figli[i].getName());
                  }
              }
          }
      }
  }
  </code></pre>