Package java.math

Examples of java.math.BigDecimal.movePointRight()


                                                        getErrorString(DatatypeMessageProvider.ScaleExceeded,
                                                                        DatatypeMessageProvider.MSG_NONE,
                                                                        new Object[] { content}));
        }
        if ( isPrecisionDefined == true ) {
            int precision = d.movePointRight(d.scale()).toString().length() -
                            ((d.signum() < 0) ? 1 : 0); // account for minus sign
            if (precision > fPrecision)
                throw new InvalidDatatypeValueException(
                                getErrorString(DatatypeMessageProvider.PrecisionExceeded,
                                 DatatypeMessageProvider.MSG_NONE,
View Full Code Here


        }
        int nanos = value.getNanos();
        BigDecimal bd = BigDecimal.valueOf(nanos);
        bd = bd.movePointLeft(9);
        bd = MathUtils.setScale(bd, targetScale);
        bd = bd.movePointRight(9);
        int n2 = bd.intValue();
        if (n2 == nanos) {
            return this;
        }
        long t = value.getTime();
View Full Code Here

        calendar.add(Calendar.SECOND, getSeconds() * signum);

        if (seconds != null) {
            BigDecimal fraction =
                seconds.subtract(seconds.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            calendar.add(Calendar.MILLISECOND, millisec * signum);
        }
    }
   
    /**
 
View Full Code Here

        final int ipSize = (ipDigits << 2) + DECIMAL_BINARY_SIZE[ipDigitsX];
        int offset = DECIMAL_BINARY_SIZE[ipDigitsX];
        BigDecimal ip = offset > 0 ? BigDecimal.valueOf(CodecUtils.toInt(value, 0, offset)) : BigDecimal.ZERO;
        for(; offset < ipSize; offset += 4) {
          final int i = CodecUtils.toInt(value, offset, 4);
          ip = ip.movePointRight(DIGITS_PER_4BYTES).add(BigDecimal.valueOf(i));
        }

        //
        int shift = 0;
        BigDecimal fp = BigDecimal.ZERO;
View Full Code Here

        }

        value = value.setScale(0, BigDecimal.ROUND_FLOOR);
        value = ((BigDecimal) a).subtract(value);

        return value.movePointRight(scale).longValue();
    }

    public static boolean isInLongLimits(BigDecimal result) {

        if (NumberType.MIN_LONG.compareTo(result) > 0
View Full Code Here

    public static String formatAmountConversionRate(double convRate) throws ISOException {
        if (convRate == 0)
            return null;
        BigDecimal cr = new BigDecimal(convRate);
        int x = 7 - cr.precision() + cr.scale();
        String bds = cr.movePointRight(cr.scale()).toString();
        if (x > 9)
            bds = ISOUtil.zeropad(bds, bds.length() + x - 9);
        String ret = ISOUtil.zeropadRight(bds, 7);
        return Math.min(9, x) + ISOUtil.takeFirstN(ret, 7);
    }
View Full Code Here

        if (offset > 0)
            intPart = BigDecimal.valueOf(convertNBytesToInt(d_copy, 0, offset));

        while (offset < integerSize)
        {
            intPart = intPart.movePointRight(LogBuffer.DIG_PER_DEC1).add(
                    BigDecimal.valueOf(convert4BytesToInt(d_copy, offset)));
            offset += 4;
        }

        // Decimal part
View Full Code Here

        calendar.add(Calendar.SECOND, getSeconds() * signum);

        if (seconds != null) {
            BigDecimal fraction =
                seconds.subtract(seconds.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            calendar.add(Calendar.MILLISECOND, millisec * signum);
        }
    }
   
    /**
 
View Full Code Here

    paramCalendar.add(12, getMinutes() * this.signum);
    paramCalendar.add(13, getSeconds() * this.signum);
    if (this.seconds != null)
    {
      BigDecimal localBigDecimal = this.seconds.subtract(this.seconds.setScale(0, 1));
      int i = localBigDecimal.movePointRight(3).intValue();
      paramCalendar.add(14, i * this.signum);
    }
  }

  public void addTo(Date paramDate)
View Full Code Here

                    Integer.valueOf(m.group(DAY_MG)), Integer.valueOf(m.group(HOUR_MG)), Integer.valueOf(m
                            .group(MIN_MG)));
            BigDecimal sec = new BigDecimal(m.group(SEC_MG));
            set(SECOND, sec.intValue());
            BigDecimal fraction = sec.subtract(sec.setScale(0, BigDecimal.ROUND_DOWN));
            int millisec = fraction.movePointRight(3).intValue();
            set(Calendar.MILLISECOND, millisec);

            String tz = m.group(TZ_MG);
            if ("Z".equals(tz)) {
                setTimeZone(TimeZone.getTimeZone("GMT"));
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.