private static void verifyPath(File file, boolean shouldBeDir) {
    if (!file.exists()) {
      throw new IllegalArgumentException(file + " does not exist");
    }
    if (shouldBeDir && !file.isDirectory()) {
      throw new IllegalArgumentException(file + " should be a directory");
    }
  }
Gets all index segment files that are present in a directory and sorts them by their logical order
@param dir the directory to look for index segment files in
@return all index segment files that are present in {@code dir} sorted by their logical order
ambry-tools/src/main/java/com/github/ambry/store/DumpIndexTool.java