protected static boolean versionCompatible(String currentVersion,String expectedVersion){
  if (Character.isDigit(expectedVersion.charAt(expectedVersion.length() - 1))) {
    if (!currentVersion.startsWith(expectedVersion)) {
      return false;
    }
  }
 else {
    boolean backwardCom=false;
    int compareLength=Math.min(expectedVersion.length() - 1,currentVersion.length());
    if (expectedVersion.endsWith("-")) {
      backwardCom=true;
    }
    for (int i=0; i < compareLength; i++) {
      if (backwardCom) {
        if (expectedVersion.charAt(i) < currentVersion.charAt(i)) {
          return false;
        }
      }
 else {
        if (currentVersion.charAt(i) > expectedVersion.charAt(i)) {
          break;
        }
        if (currentVersion.charAt(i) < expectedVersion.charAt(i)) {
          return false;
        }
      }
    }
  }
  return true;
}

protected static boolean versionCompatible ( String currentVersion , String expectedVersion ) { if ( Character . isDigit ( expectedVersion . charAt ( expectedVersion . length ( ) - 1 ) ) ) { if ( ! currentVersion . startsWith ( expectedVersion ) ) { return false ; } } else { boolean backwardCom = false ; int compareLength = Math . min ( expectedVersion . length ( ) - 1 , currentVersion . length ( ) ) ; if ( expectedVersion . endsWith ( "-" ) ) { backwardCom = true ; } for ( int i = 0 ; i < compareLength ; i ++ ) { if ( backwardCom ) { if ( expectedVersion . charAt ( i ) < currentVersion . charAt ( i ) ) { return false ; } } else { if ( currentVersion . charAt ( i ) > expectedVersion . charAt ( i ) ) { break ; } if ( currentVersion . charAt ( i ) < expectedVersion . charAt ( i ) ) { return false ; } } } } return true ; }
check whether the version string is compatible with expected .
