Package java.math

Examples of java.math.BigDecimal.longValue()


            return new IntervalSecondData(result.longValue(), nanos, this,
                                          true);
        } else {
            if (isYearMonth) {
                return result.longValue();
            } else {
                return result;
            }
        }
    }
View Full Code Here


            shippableWeight = BigDecimal.ONE;
        }
        if ((dhlShipmentDetailCode.equals("G") && shippableWeight.compareTo(new BigDecimal("999")) > 0) || (shippableWeight.compareTo(new BigDecimal("150")) > 0)) {
            return ServiceUtil.returnError("Cannot get DHL Estimate: Shippable weight cannot be greater than 999 lbs for ground or 150 lbs for all other services.");
        }
        String weight = (Integer.valueOf((int) shippableWeight.longValue())).toString();

        // create AccessRequest XML doc using FreeMarker template
        String templateName = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.template.dhl.rate.estimate");
        if ((templateName == null) || (templateName.trim().length() == 0)) {
            return ServiceUtil.returnError("Cannot get DHL Estimate: DHL Rate template not configured (shipment.template.dhl.rate.estimate");
View Full Code Here

        case TYPE_FLOAT:
            resultObj = Float.valueOf(resultValue.floatValue());
            break;
        case TYPE_LONG:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Long.valueOf(resultValue.longValue());
            break;
        case TYPE_INTEGER:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Integer.valueOf(resultValue.intValue());
            break;
View Full Code Here

     * a long value, otherwise precision will be lost in this conversion.
     */
    @Override
    public Long getLong(Object number) {
        BigDecimal longField = (BigDecimal) number;
        return longField.longValue();
    }

    /* (non-Javadoc)
     * @see org.rhq.core.db.DatabaseType#getString(java.lang.String, int)
     *
 
View Full Code Here

            df = this.getDefaultFormat(locale);
        } else {
            df = ((DateSpecifics) specifics).getDateFormat();
        }

        return new FormattedNumber(df.format(new Date(dec.longValue())), "");
    }

    public FormattedNumber[] formatSame(double[] val, UnitsConstants unitType, ScaleConstants scale, Locale locale) {
        FormattedNumber[] res;
View Full Code Here

            } else if ("Double".equals(type) || "java.lang.Double".equals(type)) {
                return Double.valueOf(bigDec.doubleValue());
            } else if ("Float".equals(type) || "java.lang.Float".equals(type)) {
                return Float.valueOf(bigDec.floatValue());
            } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
                return Long.valueOf(bigDec.longValue());
            } else if ("Integer".equals(type) || "java.lang.Integer".equals(type)) {
                return Integer.valueOf(bigDec.intValue());
            } else if ("List".equals(type) || "java.util.List".equals(type)) {
                List<BigDecimal> tempList = FastList.newInstance();
                tempList.add(bigDec);
View Full Code Here

            } else if ("Double".equals(type) || "java.lang.Double".equals(type)) {
                return Double.valueOf(bigDec.doubleValue());
            } else if ("Float".equals(type) || "java.lang.Float".equals(type)) {
                return Float.valueOf(bigDec.floatValue());
            } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
                return Long.valueOf(bigDec.longValue());
            } else if ("Integer".equals(type) || "java.lang.Integer".equals(type)) {
                return Integer.valueOf(bigDec.intValue());
            } else if ("List".equals(type) || "java.util.List".equals(type)) {
                List<BigDecimal> tempList = FastList.newInstance();
                tempList.add(bigDec);
View Full Code Here

        case TYPE_FLOAT:
            resultObj = Float.valueOf(resultValue.floatValue());
            break;
        case TYPE_LONG:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Long.valueOf(resultValue.longValue());
            break;
        case TYPE_INTEGER:
            resultValue = resultValue.setScale(0, roundingMode);
            resultObj = Integer.valueOf(resultValue.intValue());
            break;
View Full Code Here

                transform_e();
                return;
            }
            BigDecimal b = new BigDecimal(d, new MathContext(precision));
            d = b.doubleValue();
            long l = b.longValue();

            if (d >= 1 && d < Math.pow(10, precision)) {
                if (l < Math.pow(10, precision)) {
                    requireScientificRepresentation = false;
                    precision -= String.valueOf(l).length();
View Full Code Here

                        case GREATER_OR_EQUAL:
                        case LESS: // get next whole number
                            increment = 1;
                        default: // Else, we truncate the value
                            BigDecimal bd = (BigDecimal)rhsValue;
                            rhsValue = bd.longValue() + increment;
                            children = Arrays.asList(lhsExpr, LiteralExpression.newConstant(rhsValue, lhsExprDataType, lhsExpr.getSortOrder(), rhsExpr.isDeterministic()));
                            break;
                        }
                        break;
                    case LONG:
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.