code: public static int getCanonicalSpecVersion() {
          final String version = ManagementFactory.getRuntimeMXBean().getSpecVersion();
          final String[] split = version.split("\\.");
  
          return split.length > 1 ? Integer.parseInt(split[1]) : Integer.parseInt(split[0]);
      }
docs: Returns the canonized number of the currently available Java language specification version.
  <p>
  The numbering scheme of the specification versions is structured as follows:
  <ul>
  <li>Java SE 7: 1.7</li>
  <li>Java SE 8: 1.8</li>
  <li>Java SE 9: 9</li>
  <li>Java SE 10: 10</li>
  </ul>
  This method returns:
  <ul>
  <li>Java SE 7: 7</li>
  <li>Java SE 8: 8</li>
  <li>Java SE 9: 9</li>
  <li>Java SE 10: 10</li>
  </ul>
  
  @return the canonized java specification version
  
  @see RuntimeMXBean#getSpecVersion()