public int getJavaVersion() {
    String versionStr = System.getProperty("java.version");
    if (versionStr.startsWith("1.6")) {
      return 6;
    } else if (versionStr.startsWith("1.7")) {
      return 7;
    } else if (versionStr.startsWith("1.8")) {
      return 8;
    } else if (versionStr.startsWith("17")) {
      return 17;
    } else { // Some unsupported java version
      return -1;
    }
  }
@return conventional Java version number, e.g. 7.
Integer is used here to simplify comparisons during usage.
If java version is not supported, returns -1
ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java