core/metrics-model/src/main/java/org/hawkular/metrics/model/Buckets.java
public static Buckets fromCount(long start, long end, int count) {
        checkTimeRange(start, end);
        checkArgument(count > 0, "count is not positive: %s", count);
        long quotient = (end - start) / count;
        long remainder = (end - start) % count;
        long step;
        // count * quotient + remainder = end - start
        // If the remainder is greater than zero, we should try with (quotient + 1), provided that this greater step
        // does not make the number of buckets smaller than the expected count
        if (remainder != 0 && (count - 1) * (quotient + 1) < (end - start)) {
            step = quotient + 1;
        } else {
            step = quotient;
        }
        checkArgument(step > 0, "Computed step is equal to zero");
        return new Buckets(start, step, count);
    }
public static Buckets fromCount(long start, long end, int count) {
        checkTimeRange(start, end);
        checkArgument(count > 0, "count is not positive: %s", count);
        long quotient = (end - start) / count;
        long remainder = (end - start) % count;
        long step;
        // count * quotient + remainder = end - start
        // If the remainder is greater than zero, we should try with (quotient + 1), provided that this greater step
        // does not make the number of buckets smaller than the expected count
        if (remainder != 0 && (count - 1) * (quotient + 1) < (end - start)) {
            step = quotient + 1;
        } else {
            step = quotient;
        }
        checkArgument(step > 0, "Computed step is equal to zero");
        return new Buckets(start, step, count);
    }
Force bucket count. This method does not guarantee that the last bucket includes the {@code end} value.

@param start start time
@param end   end time
@param count desired number of buckets

@return an instance of {@link Buckets}, starting at {@code start}, separated by {@code count} intervals