static int majorVersion(final String javaSpecVersion) {
        final String[] components = javaSpecVersion.split("\\.");
        final int[] version = new int[components.length];
        for (int i = 0; i < components.length; i++) {
            version[i] = Integer.parseInt(components[i]);
        }

        if (version[0] == 1) {
            assert version[1] >= 6;
            return version[1];
        } else {
            return version[0];
        }
    }
@Test
    public void testMajorVersion() {
        assertEquals(6, PlatformDependent0.majorVersion("1.6"));
        assertEquals(7, PlatformDependent0.majorVersion("1.7"));
        assertEquals(8, PlatformDependent0.majorVersion("1.8"));
        assertEquals(8, PlatformDependent0.majorVersion("8"));
        assertEquals(9, PlatformDependent0.majorVersion("1.9")); // early version of JDK 9 before Project Verona
        assertEquals(9, PlatformDependent0.majorVersion("9"));
    }