code: private int compareToVersionNumber(VersionIdentifier otherVersion) {
  
      // Example version: 1.2.3.4
      // Direct successors: 1.2.3.5 / 1.2.4[.0] / 1.3.[.0[.0]] / 2.[.0[.0[.0]]]
      // Direct predecessors: 1.2.3.3[.*]
      boolean equivalent = true;
      int result = 0;
      int maxSegmentCount = StrictMath.max(getVersionSegmentCount(), otherVersion.getVersionSegmentCount());
      for (int i = 0; i < maxSegmentCount; i++) {
        int segment = getVersionSegment(i);
        int otherSegment = otherVersion.getVersionSegment(i);
        if (segment != otherSegment) {
          int delta = segment - otherSegment;
          if (equivalent) {
            result = delta;
          } else {
            if (result == COMPARE_TO_STRICT_SUCCESSOR) {
              if (segment != 0) {
                result++;
                break;
              }
            } else if (result == COMPARE_TO_STRICT_PREDECESSOR) {
              if (otherSegment != 0) {
                result--;
                break;
              }
            }
          }
        }
      }
      return result;
    }
docs: This method performs the part of {@link #compareTo(VersionIdentifier)} for the
  {@link #getVersionSegment(int) version number}.
  
  @param otherVersion is the {@link VersionIdentifier} to compare to.
  @return the result of comparison.