simulator/src/main/java/com/hazelcast/simulator/utils/VersionUtils.java
public static int versionCompare(String firstVersionString, String secondVersionString) {
        String[] firstVersion = parseVersionString(firstVersionString);
        String[] secondVersion = parseVersionString(secondVersionString);

        int i = 0;
        // set index to first non-equal ordinal or length of shortest version string
        while (i < firstVersion.length && i < secondVersion.length && firstVersion[i].equals(secondVersion[i])) {
            i++;
        }
        if (i < firstVersion.length && i < secondVersion.length) {
            // compare first non-equal ordinal number
            int diff = Integer.valueOf(firstVersion[i]).compareTo(Integer.valueOf(secondVersion[i]));
            return Integer.signum(diff);
        } else {
            // the strings are equal or one string is a substring of the other
            // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
            return Integer.signum(firstVersion.length - secondVersion.length);
        }
    }
public static int versionCompare(String firstVersionString, String secondVersionString) {
        String[] firstVersion = parseVersionString(firstVersionString);
        String[] secondVersion = parseVersionString(secondVersionString);

        int i = 0;
        // set index to first non-equal ordinal or length of shortest version string
        while (i < firstVersion.length && i < secondVersion.length && firstVersion[i].equals(secondVersion[i])) {
            i++;
        }
        if (i < firstVersion.length && i < secondVersion.length) {
            // compare first non-equal ordinal number
            int diff = Integer.valueOf(firstVersion[i]).compareTo(Integer.valueOf(secondVersion[i]));
            return Integer.signum(diff);
        } else {
            // the strings are equal or one string is a substring of the other
            // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
            return Integer.signum(firstVersion.length - secondVersion.length);
        }
    }
public static int versionCompare ( String firstVersionString , String secondVersionString ) { String [ ] firstVersion = parseVersionString ( firstVersionString ) ; String [ ] secondVersion = parseVersionString ( secondVersionString ) ; int i = 0 ; // set index to first non-equal ordinal or length of shortest version string while ( i < firstVersion . length && i < secondVersion . length && firstVersion [ i ] . equals ( secondVersion [ i ] ) ) { i ++ ; } if ( i < firstVersion . length && i < secondVersion . length ) { // compare first non-equal ordinal number int diff = Integer . valueOf ( firstVersion [ i ] ) . compareTo ( Integer . valueOf ( secondVersion [ i ] ) ) ; return Integer . signum ( diff ) ; } else { // the strings are equal or one string is a substring of the other // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer . signum ( firstVersion . length - secondVersion . length ) ; } }
Compares two version strings.

Use this instead of String.compareTo() for a non-lexicographical comparison that works for version strings,
e.g. versionCompare("1.10", "1.6").

Warning:
- It does not work if "1.10" is supposed to be equal to "1.10.0".
- Everything after a "-" is ignored.

@param firstVersionString  a string of ordinal numbers separated by decimal points.
@param secondVersionString a string of ordinal numbers separated by decimal points.
@return The result is a negative integer if firstVersionString is _numerically_ less than secondVersionString.
The result is a positive integer if firstVersionString is _numerically_ greater than secondVersionString.
The result is zero if the strings are _numerically_ equal.
Compares two version strings .