int (@NotNull String leftVersion, @NotNull String rightVersion) { String[] leftVersionParts = leftVersion.split("[.-]"); String[] rightVersionParts = rightVersion.split("[.-]"); int sizes = Math.max(leftVersionParts.length, rightVersionParts.length); for (int i = 0; i < sizes; ++i) { int leftNumber = getVersionPart(leftVersionParts, i); int rightNumber = getVersionPart(rightVersionParts, i); if (leftNumber < rightNumber) { return -1; } else if (leftNumber > rightNumber) { return 1; } } return 0; }