public static int jdkToClassVersion(@NotNull String version){
  int dot=version.indexOf('.');
  if (dot != -1) {
    dot++;
    int end=version.length();
    for (int i=dot; i < end; i++) {
      if (!Character.isDigit(version.charAt(i))) {
        end=i;
        break;
      }
    }
    if (end > dot) {
      int major=Integer.valueOf(version.substring(dot,end));
      if (major > 0) {
        return major + 44;
      }
    }
  }
  return -1;
}

public static int jdkToClassVersion ( @ NotNull String version ) { int dot = version . indexOf ( '.' ) ; if ( dot != - 1 ) { dot ++ ; int end = version . length ( ) ; for ( int i = dot ; i < end ; i ++ ) { if ( ! Character . isDigit ( version . charAt ( i ) ) ) { end = i ; break ; } } if ( end > dot ) { int major = Integer . valueOf ( version . substring ( dot , end ) ) ; if ( major > 0 ) { return major + 44 ; } } } return - 1 ; }
converts a jdk string like 1 . 6 . 0_65 to the corresponding class file version number , e . g . 50
