code: public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) {
          if (bd != null && scale != null) {
              return bd.setScale(scale, rounding);
          }
          return null;
      }
docs: returns a new BigDecimal with correct Scales.PERCENT_SCALE. This is used
  by the table renderer.
  
  @param bd
  @return new bd or null