private static List<long[]> accumulateDayCounts(Map<Integer, long[]> fromDayCounts, DateTime start, DateTime end,
			int subSize) {
		List<long[]> days = new ArrayList<long[]>();
		Duration step = Duration.standardDays(1);
		long[] emptySubArray = new long[subSize];
		end = end.plusDays(1); // Need to account for an interval which crosses days

		for (DateTime now = start; now.isBefore(end); now = now.plus(step)) {
			int countsByDayKey = now.getYear() * 1000 + now.getDayOfYear();
			long[] dayCounts = fromDayCounts.get(countsByDayKey);

			if (dayCounts == null) {
				// Use an empty array if we don't have data
				dayCounts = emptySubArray;
			}
			days.add(dayCounts);
		}
		return days;
	}
A counter that tracks integral values but also remembers how its value was distributed over time.

<p>
This core class only holds data structures. Depending on backing stores, logic for computing totals may be
implemented in a specialization of this class or at the repository level.
</p>

@author Luke Taylor
@author Eric Bottard
spring-xd-analytics/src/main/java/org/springframework/xd/analytics/metrics/memory/InMemoryAggregateCounter.java