static int parseMajorJavaVersion(String javaVersion) {
    int version = parseDotted(javaVersion);
    if (version == -1) {
      version = extractBeginningInt(javaVersion);
    }
    if (version == -1) {
      return 6; // Choose minimum supported JDK version as default
    }
    return version;
  }
@Test
  public void testJava7() {
    // http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html
    assertThat(JavaVersion.parseMajorJavaVersion("1.7.0")).isEqualTo(7);
  }