Package java.math

Examples of java.math.BigDecimal.divide()


        }
        if (UtilValidate.isNotEmpty(minimumOrderPriceList)) {
            minimumOrderPrice = EntityUtil.getFirst(minimumOrderPriceList).getBigDecimal("price");
        }
        if (itemBasePrice != null && minimumOrderPrice.compareTo(itemBasePrice) > 0) {
            minQuantity = minimumOrderPrice.divide(itemBasePrice, 0, BigDecimal.ROUND_UP);
        }
        return minQuantity;
    }
}
View Full Code Here


                    quoteUnitPrice = BigDecimal.ZERO;
                }
                if (amount.compareTo(BigDecimal.ZERO) > 0) {
                    // If, in the quote, an amount is set, we need to
                    // pass to the cart the quoteUnitPrice/amount value.
                    quoteUnitPrice = quoteUnitPrice.divide(amount, generalRounding);
                }

                //rental product data
                Timestamp reservStart = quoteItem.getTimestamp("reservStart");
                BigDecimal reservLength = quoteItem.getBigDecimal("reservLength");
View Full Code Here

            DecimalFormat decimalFormat = new DecimalFormat();
            decimalFormat.applyPattern("0.00");
            if (UtilValidate.isNotEmpty(fontSize)) {
                BigDecimal widthBase = new BigDecimal(600.00);
                BigDecimal picWidth = new BigDecimal(decimalFormat.format(Float.parseFloat(width)));
                Font graphicsFont = setFontSize(fontSize, picWidth.divide(widthBase, 2));
                watermarkerSettings.setGraphicsFont(graphicsFont);
            } else {
                String errMsg = "Please select Text Size.";
                request.setAttribute("_ERROR_MESSAGE_", errMsg);
                return "error";
View Full Code Here

      }
    }

    if (onlyValidFields)
    {
      return computedResult.divide(new BigDecimal(count), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }

    if (values.length > 0)
    {
      return computedResult.divide(new BigDecimal(values.length), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
View Full Code Here

      return computedResult.divide(new BigDecimal(count), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }

    if (values.length > 0)
    {
      return computedResult.divide(new BigDecimal(values.length), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
    }
    else
    {
      return BigDecimal.ZERO;
    }
View Full Code Here

          computedResult = new BigDecimal(n.toString());
        }
        else
        {
          //noinspection ObjectToString
          computedResult = computedResult.divide(new BigDecimal(n.toString()), DEFAULT_SCALE, BigDecimal.ROUND_HALF_UP);
        }
      }
    }

    if (computedResult != null)
View Full Code Here

        count++;
      }
    }
    if (count > 0)
    {
      return total.divide(new BigDecimal(String.valueOf(count)), scale, roundingMode);
    }
    return ZERO;
  }

  /**
 
View Full Code Here

    }

    if (useDifference)
    {
      final BigDecimal delta = dividend.subtract(divisor);
      return delta.divide(divisor, scale, roundingMode);
    }
    else
    {
      return dividend.divide(divisor, scale, roundingMode);
    }
View Full Code Here

    if (count.longValue() == 0)
    {
      return null;
    }

    return sum.divide(count, scale, roundingMode);
  }

  /**
   * Return a completly separated copy of this function. The copy does no longer share any changeable objects with the
   * original function.
View Full Code Here

    Parameters.checkCondition(values.length > 0);
    BigDecimal sum = BigDecimal.ZERO;
    for (long value : values) {
      sum = sum.add(BigDecimal.valueOf(value));
    }
    return sum.divide(BigDecimal.valueOf(values.length)).doubleValue();
  }

  /**
   * Returns the arithmetic mean of the given values. This method is not
   * subject to overflow.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.