static long calcInterval(int segments, int start, int limit) {

        long range = limit - start;

        if (range < 0) {
            return 0;
        }

        int partSegment = (range % segments) == 0 ? 0
                                                  : 1;

        return (range / segments) + partSegment;
    }
static long calcInterval ( int segments , int start , int limit ) { long range = limit - start ; if ( range < 0 ) { return 0 ; } int partSegment = ( range % segments ) == 0 ? 0 : 1 ; return ( range / segments ) + partSegment ; }
Helper method to calculate the span of the sub-interval. Simply returns
the cieling of ((limit - start) / segments) and accounts for invalid
start and limit combinations.