public static int parseMajorVersion(String version) {
    if (version.endsWith("-ea")) {
      version = version.substring(0, version.length() - 3);
    }
    if (version.startsWith("1.")) {
      version = version.substring(2, 3);
    } else {
      int dot = version.indexOf(".");
      if (dot != -1) {
        version = version.substring(0, dot);
      }
    }
    return Integer.parseInt(version);
  }
@Test
  public void parseVersion() throws Exception {
    assertEquals(8, CommonUtils.parseMajorVersion("1.8.0"));
    assertEquals(11, CommonUtils.parseMajorVersion("11.0.1"));
    assertEquals(9, CommonUtils.parseMajorVersion("9.0.1"));
  }