code: private int computeTargetPartitionSize(Histogram histogram, int minTargetPartitionSize, int maxPartitions) {
       return Math.max(minTargetPartitionSize,
          DoubleMath.roundToInt((double) histogram.totalRecordCount / maxPartitions, RoundingMode.CEILING));
    }
docs: Compute the target partition size.