code: public static double[] range2Bins( double min, double max, int binsNum ) {
          double delta = (max - min) / binsNum;
          double[] bins = new double[binsNum + 1];
          int count = 0;
          double running = min;
          for( int i = 0; i < binsNum; i++ ) {
              bins[count] = running;
              running = running + delta;
              count++;
          }
          bins[binsNum] = max;
          return bins;
      }
docs: Creates an array of equal bin from a range and the number of bins.
  
  @param min the min value.
  @param max the max value.
  @param binsNum the number of wanted bins.
  @return the array of bin bounds of size [binNum+1], since it contains the min and max.