public static File findLatestBuildToolsFolder(File buildToolsHome) {
    File[] buildToolsVersions = buildToolsHome.listFiles(new FileFilter() {
      @Override
      public boolean accept(File file) {
        return file.getName().matches(BUILD_TOOLS_VERSION_REGEX);
      }
    });

    if (buildToolsVersions == null || buildToolsVersions.length == 0) {
      throw new SelendroidException("No valid build-tools versions found in " + buildToolsHome.getName());
    }

    Pattern pattern = Pattern.compile(BUILD_TOOLS_VERSION_REGEX);
    Arrays.sort(
      buildToolsVersions,
      new Comparator<File>() {
        @Override
        public int compare(File f1, File f2) {
          Matcher m1 = pattern.matcher(f1.getName());
          Matcher m2 = pattern.matcher(f2.getName());

          m1.find();
          m2.find();

          for (int i = 1; i <= 3; i++) {
            int compare = Integer.compare(
              Integer.parseInt(m1.group(i)),
              Integer.parseInt(m2.group(i)));

            if (compare != 0) {
              return compare;
            }
          }

          return 0;
        }
      });

    return buildToolsVersions[buildToolsVersions.length - 1].getAbsoluteFile();
  }
@return path to android.jar of latest android api.
selendroid-standalone/src/main/java/io/selendroid/standalone/android/AndroidSdk.java