code: public static double[][] histogram( List<LasRecord> points, VALUETYPE valueType, int bins ) {
          double min = Double.POSITIVE_INFINITY;
          double max = Double.NEGATIVE_INFINITY;
  
          for( LasRecord lasRecord : points ) {
              double value = getValue(valueType, lasRecord);
              min = Math.min(min, value);
              max = Math.max(max, value);
          }
  
          double range = max - min;
          double step = range / bins;
          double[][] histogram = new double[bins][3];
          for( int i = 0; i < histogram.length; i++ ) {
              histogram[i][0] = min + step * (i + 1);
          }
  
          for( LasRecord lasRecord : points ) {
              double value = getValue(valueType, lasRecord);
              for( int j = 0; j < histogram.length; j++ ) {
                  if (value <= histogram[j][0]) {
                      histogram[j][1] = histogram[j][1] + 1;
                      break;
                  }
              }
          }
  
          double cumulatedMax = 0;
          for( int i = 0; i < histogram.length; i++ ) {
              if (i == 0) {
                  histogram[i][2] = histogram[i][1];
              } else {
                  histogram[i][2] = (histogram[i - 1][2] + histogram[i][1]);
              }
              cumulatedMax = histogram[i][2];
          }
  
          for( int i = 0; i < histogram.length; i++ ) {
              histogram[i][2] = histogram[i][2] / cumulatedMax;
              // and move the bin markers to their centers
              histogram[i][0] = histogram[i][0] - step / 2.0;
          }
  
          return histogram;
      }
docs: Calculate the histogram of a list of {@link LasRecord}s.
  
  @param points the list of points.
  @param valueType the value to consider.
  @param bins the number of bins.
  @return the histogram as matrix of rows num like bins and 3 columns for [binCenter, count, cummulated-normalize-count].