code: public static Array<FileHandle> sortFiles (FileHandle[] files, Comparator<FileHandle> comparator, boolean descending) {
  		Array<FileHandle> directoriesList = new Array<FileHandle>();
  		Array<FileHandle> filesList = new Array<FileHandle>();
  
  		for (FileHandle f : files) {
  			if (f.isDirectory()) {
  				directoriesList.add(f);
  			} else {
  				filesList.add(f);
  			}
  		}
  
  		Sort sorter = new Sort();
  		sorter.sort(directoriesList, comparator);
  		sorter.sort(filesList, comparator);
  
  		if (descending) {
  			directoriesList.reverse();
  			filesList.reverse();
  		}
  
  		directoriesList.addAll(filesList); // combine lists
  		return directoriesList;
  	}
docs: Sorts file list, using this rules: directories first, sorted using provided comparator, then files sorted using provided comparator.
  @param files list to sort
  @param comparator comparator used to sort files list
  @param descending if true then sorted list will be in reversed order
  @return sorted file list