core/metrics-model/src/main/java/org/hawkular/metrics/model/Buckets.java
public static Buckets fromStep(long start, long end, long step) {
        checkTimeRange(start, end);
        checkArgument(step > 0, "step is not positive: %s", step);
        if (step > (end - start)) {
            return new Buckets(start, step, 1);
        }
        long quotient = (end - start) / step;
        long remainder = (end - start) % step;
        long count;
        if (remainder == 0) {
            count = quotient;
        } else {
            count = quotient + 1;
        }
        checkArgument(count <= Integer.MAX_VALUE, "Computed number of buckets is too big: %s", count);
        return new Buckets(start, step, (int) count);
    }
public static Buckets fromStep(long start, long end, long step) {
        checkTimeRange(start, end);
        checkArgument(step > 0, "step is not positive: %s", step);
        if (step > (end - start)) {
            return new Buckets(start, step, 1);
        }
        long quotient = (end - start) / step;
        long remainder = (end - start) % step;
        long count;
        if (remainder == 0) {
            count = quotient;
        } else {
            count = quotient + 1;
        }
        checkArgument(count <= Integer.MAX_VALUE, "Computed number of buckets is too big: %s", count);
        return new Buckets(start, step, (int) count);
    }
public static Buckets fromStep ( long start , long end , long step ) { checkTimeRange ( start , end ) ; checkArgument ( step > 0 , "step is not positive: %s" , step ) ; if ( step > ( end - start ) ) { return new Buckets ( start , step , 1 ) ; } long quotient = ( end - start ) / step ; long remainder = ( end - start ) % step ; long count ; if ( remainder == 0 ) { count = quotient ; } else { count = quotient + 1 ; } checkArgument ( count <= Integer . MAX_VALUE , "Computed number of buckets is too big: %s" , count ) ; return new Buckets ( start , step , ( int ) count ) ; }
Force bucket step.

@param start start time
@param end   end time
@param step  desired step

@return an instance of {@link Buckets}, starting at {@code start}, separated by intervals of size {@code step}
Force bucket step .