code: private void update(){
          
          int i, n = values.length;
  
          max = 0;
          min = n;
          total = 0;
          
          int maxVal = -Integer.MAX_VALUE;
          int minVal = Integer.MAX_VALUE;
  
          // calculate min and max
          for ( i = 0; i < n; i++ )
          {
              if ( values[i] != 0 )
              {
                  // max
                  if ( i > max )
                      max = i;
                  // min
                  if ( i < min )
                      min = i;
  
                  maxVal = Math.max(maxVal, values[i]);
                  minVal = Math.min(minVal, values[i]);
                  total += values[i];
              }
          }
          
          double k = (maxVal - minVal) / (double)bins;
          int[] h = new int[bins];
          
          for (int j = 0; j < values.length; j++) {
              double _min = minVal;
              double _max = _min + k;
              
              //First interval.
              if(values[j] >= _min && values[j] <= _max)
                  h[0]++;
              
              _min += k;
              _max += k;
              
              //Others interval.
              for (int l = 1; l < bins; l++) {
                  if(values[j] > _min && values[j] <= _max)
                      h[l]++;
                  
                  _min += k;
                  _max += k;
              }
          }
          
          this.values = h;
  
          mean   = HistogramStatistics.Mean( values );
          stdDev = HistogramStatistics.StdDev( values, mean );
          median = HistogramStatistics.Median( values );
          mode = HistogramStatistics.Mode(values);
          entropy = HistogramStatistics.Entropy(values);
      }
docs: Update histogram.