Package java.math

Examples of java.math.BigDecimal.toPlainString()


        BigDecimal localTime = localTimeParam;
        if (localTime.compareTo(BigDecimal.ZERO) == -1) {
            localTime = localTime.add(BigDecimal.valueOf(24.0D));
            resultTime.add(Calendar.HOUR_OF_DAY, -24);
        }
        String[] timeComponents = localTime.toPlainString().split("\\.");
        int hour = Integer.parseInt(timeComponents[0]);

        BigDecimal minutes = new BigDecimal("0." + timeComponents[1]);
        minutes = minutes.multiply(BigDecimal.valueOf(60)).setScale(0, RoundingMode.HALF_EVEN);
        if (minutes.intValue() == 60) {
View Full Code Here


        || hfsType == HCatFieldSchema.Type.VARCHAR
        || hfsType == HCatFieldSchema.Type.CHAR) {
      BigDecimal bd = (BigDecimal) val;
      String bdStr = null;
      if (bigDecimalFormatString) {
        bdStr = bd.toPlainString();
      } else {
        bdStr = bd.toString();
      }
      if (hfsType == HCatFieldSchema.Type.VARCHAR) {
        VarcharTypeInfo vti = (VarcharTypeInfo) hfs.getTypeInfo();
View Full Code Here

     *            A {@link BigDecimal} Object.
     * @return The String representation of the {@link BigDecimal}.
     */
    public final String formatObject(final Object object) {
  BigDecimal bigDecimal = (BigDecimal) object;
  return bigDecimal.toPlainString();
    }

}
View Full Code Here

        else if (XMLDatatypeUtil.isNumericDatatype(datatype)) {
          // FIXME: floats and doubles must be processed separately, see
          // http://www.w3.org/TR/xpath-functions/#casting-from-primitive-to-primitive
          try {
            BigDecimal decimalValue = literal.decimalValue();
            return valueFactory.createLiteral(decimalValue.toPlainString(), XMLSchema.DECIMAL);
          }
          catch (NumberFormatException e) {
            throw new ValueExprEvaluationException(e.getMessage(), e);
          }
        }
View Full Code Here

            }

            if (value instanceof BigDecimal)
            {
                BigDecimal bd = (BigDecimal) value;
                String str = bd.toPlainString();
                if (str.contains("."))
                {
                    return error("Cannot assign BigDecimal to BigInteger if BigDecimal has fractional part: " + value);
                }
                x = new BigInteger(str);
View Full Code Here

        for ( int i = 0; i < expected.length; i++ ) {
            DTCellValue52 dcv = actual.get( i );
            switch ( dcv.getDataType() ) {
                case NUMERIC :
                    final BigDecimal numeric = (BigDecimal) dcv.getNumericValue();
                    if ( !expected[i].equals( numeric.toPlainString() ) ) {
                        return false;
                    }
                    break;
                case NUMERIC_BIGDECIMAL :
                    final BigDecimal numericBigDecimal = (BigDecimal) dcv.getNumericValue();
View Full Code Here

                        return false;
                    }
                    break;
                case NUMERIC_BIGDECIMAL :
                    final BigDecimal numericBigDecimal = (BigDecimal) dcv.getNumericValue();
                    if ( !expected[i].equals( numericBigDecimal.toPlainString() ) ) {
                        return false;
                    }
                    break;
                case NUMERIC_BIGINTEGER :
                    final BigInteger numericBigInteger = (BigInteger) dcv.getNumericValue();
View Full Code Here

    {
        public void write(Object obj, boolean showType, Writer out) throws IOException
        {
            BigDecimal big = (BigDecimal) obj;
            out.write("\"value\":\"");
            out.write(big.toPlainString());
            out.write('"');
        }

        public boolean hasPrimitiveForm() { return true; }
View Full Code Here

        public void writePrimitiveForm(Object o, Writer out) throws IOException
        {
            BigDecimal big = (BigDecimal) o;
            out.write('"');
            out.write(big.toPlainString());
            out.write('"');
        }
    }

    public static class StringBuilderWriter implements JsonClassWriter
View Full Code Here

            }

            if (value instanceof BigDecimal)
            {
                BigDecimal bd = (BigDecimal) value;
                String str = bd.toPlainString();
                if (str.contains("."))
                {
                    return error("Cannot assign BigDecimal to BigInteger if BigDecimal has fractional part: " + value);
                }
                x = new BigInteger(str);
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.