public static String parse(String version) {
        if (startsWith(version, "1.")) {
            Matcher m = JAVA_VERSION_1_X.matcher(version);
            m.find();
            return m.group();
        } else {
            Matcher m = JAVA_VERSION_X.matcher(version);
            m.find();
            return m.group();
        }
    }
@Test
    public void testParse() {
        assertThat(JavaVersion.parse("1.8.0_362"), is("1.8"));
        assertThat(JavaVersion.parse("11.0.18"), is("11"));
        assertThat(JavaVersion.parse("9.0.4"), is("9"));
        assertThat(JavaVersion.parse("10.0.1"), is("10"));
    }