public decimal CalculateMean()
{
long lowerBound = _counts[0] > 0L ? _minValue : 0L;
decimal total = 0;
for (int i = 0, size = _upperBounds.Length; i < size; i++)
{
long upperBound = Math.Min(_upperBounds[i], _maxValue);
long midPoint = lowerBound + ((upperBound - lowerBound)/2L);
decimal intervalTotal = midPoint*_counts[i];
total += intervalTotal;
lowerBound = Math.Max(_upperBounds[i] + 1L, _minValue);
}
return total/Count;
}