private boolean processDirectory(File dir, boolean topLevel) {
    if (topLevel) {
      dir = new File(dir, ".");
    }

    File[] files = dir.listFiles();
    int len = files.length;
    boolean any = false;

    if (sort) {
      Arrays.sort(
          files,
          new Comparator<File>() {
            @Override
            public int compare(File a, File b) {
              return compareClassNames(a.getName(), b.getName());
            }
          });
    }

    for (int i = 0; i < len; i++) {
      any |= processOne(files[i], false);
    }

    return any;
  }
Processes a directory recursively.

@param dir {@code non-null;} file representing the directory
@param topLevel whether this is a top-level directory (that is, specified directly on the
    commandline)
@return whether any processing actually happened
android/android_framework/dex-maker/src/main/java/com/android/dx/cf/direct/ClassPathOpener.java