Examples of divide()


Examples of java.math.BigDecimal.divide()

        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigDecimal bd = new BigDecimal(
            values.get(values.size() / 2 - 1));
        bd = bd.add(new BigDecimal(values.get(values.size() / 2)));
        return bd.divide(new BigDecimal(2)).floatValue();
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigDecimal.divide()

        if (values.size() == 1)
          return values.get(0);
        BigDecimal total = new BigDecimal(0);
        for (int i = 0; i < values.size(); ++i)
          total = total.add(BigDecimal.valueOf(values.get(i)));
        return total.divide(BigDecimal.valueOf((long)values.size()), 10, RoundingMode.HALF_EVEN).doubleValue();
      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigDecimal bd = new BigDecimal(
            values.get(values.size() / 2 - 1));
View Full Code Here

Examples of java.math.BigDecimal.divide()

        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigDecimal bd = new BigDecimal(
            values.get(values.size() / 2 - 1));
        bd = bd.add(new BigDecimal(values.get(values.size() / 2)));
        return bd.divide(new BigDecimal(2)).doubleValue();
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigDecimal.divide()

        if (values.size() == 1)
          return values.get(0);
        BigDecimal total = new BigDecimal(0);
        for (int i = 0; i < values.size(); ++i)
          total = total.add(values.get(i));
        return total.divide(BigDecimal.valueOf(values.size()), RoundingMode.HALF_UP);
      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigDecimal bd = values.get(values.size() / 2 - 1);
        bd = bd.add(values.get(values.size() / 2));
View Full Code Here

Examples of java.math.BigDecimal.divide()

      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigDecimal bd = values.get(values.size() / 2 - 1);
        bd = bd.add(values.get(values.size() / 2));
        return bd.divide(new BigDecimal(2));
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigDecimal.divide()

        if (size % 2 == 1) {
            return bigDecimalNumbers[start + (size + 1) / 2 - 1];
        } else {
            BigDecimal result = bigDecimalNumbers[start + (size) / 2 - 1];
            result = result.add(bigDecimalNumbers[start + (size) / 2]);
            return result.divide(BigDecimal.valueOf(2));
        }
    }

    private static BigDecimal quartile1(BigDecimal[] bigDecimalNumbers) {
        final int size = bigDecimalNumbers.length;
View Full Code Here

Examples of java.math.BigDecimal.divide()

                    BigDecimal usageCostAmount = ZERO;
                    if (usageCost != null) {
                        usageCostAmount = usageCost.getBigDecimal("amount").multiply(BigDecimal.valueOf(actualMilliSeconds.doubleValue()));
                    }
                    BigDecimal fixedAssetCost = setupCostAmount.add(usageCostAmount).setScale(decimals, rounding);
                    fixedAssetCost = fixedAssetCost.divide(BigDecimal.valueOf(3600000), decimals, rounding);
                    // store the cost
                    Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin,
                            "workEffortId", productionRunTaskId);
                    inMap.put("costComponentTypeId", "ACTUAL_ROUTE_COST");
                    inMap.put("costUomId", currencyUomId);
View Full Code Here

Examples of java.math.BigDecimal.divide()

       
        // divide

      x = new BigDecimal("6.9609119610E-78");
        y = new BigDecimal("4E-48");
      r = x.divide(y, 40, 6);                     // ROUND_HALF_EVEN
      System.out.println( r.toString() );
      // 1.7402279902E-30

       
        x = new BigDecimal("5.383458817E-83");
View Full Code Here

Examples of java.math.BigDecimal.divide()

      // 1.7402279902E-30

       
        x = new BigDecimal("5.383458817E-83");
        y = new BigDecimal("8E-54");
        r = x.divide(y, 40, 6);
        System.out.println( r.toString() );
        // 6.7293235212E-30

       
        // compareTo
View Full Code Here

Examples of java.math.BigDecimal.divide()

            final BigDecimal MB = new BigDecimal(1000L * 1000);
            final BigDecimal GB = new BigDecimal(1000L * 1000 * 1000);

            BigDecimal bd = new BigDecimal(value);
            if (bd.compareTo(GB) > 0) {
                bd = bd.divide(GB);
                suffix = "GB";
            } else if (bd.compareTo(MB) > 0) {
                bd = bd.divide(MB);
                suffix = "MB";
            } else if (bd.compareTo(KB) > 0) {
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.