/** * Creates a frequency table. The number of items in each class is returned. Classes are defined * by the limit and resolution. E.g. for a limit of 1200 with a resolution of 400 there are 3 * classes: [0-400[, [400-800[ and [800-1200[. * * @param values the data to distribute over the bins/classes. * @param classWidth the resolution or the with of the classes * @param start the starting value * @param stop the stopping value * @return The number of items in each class */ public static Histogram createFrequencyTable( final List<Double> values, final double classWidth, final double start, final double stop) { final Histogram histogram = new Histogram(start, stop, (int) ((stop - start) / classWidth)); for (final Double value : values) { histogram.add(value); } assert histogram.getSumFreq() == values.size() : "Number of items in bins does no" + "t correspond with total number of items"; return histogram; }