Java BigDecimal from doubleToBigDecimal(double amountAsDouble)

Here you can find the source of doubleToBigDecimal(double amountAsDouble)

Description

double To Big Decimal

License

Open Source License

Declaration

public static BigDecimal doubleToBigDecimal(double amountAsDouble) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
    public static final int DECIMAL_SCALE = 8;
    public static final RoundingMode ROUNDING_MODE = RoundingMode.HALF_UP;

    public static BigDecimal doubleToBigDecimal(double amountAsDouble) {
        return new BigDecimal(amountAsDouble).setScale(DECIMAL_SCALE, ROUNDING_MODE);
    }/*from   w ww . j  a v  a2s.  c  om*/
}

Related

  1. byteToBigDecimal(byte[] raw)
  2. castBigDecimal(Object o)
  3. castToBigDecimal(Object value)
  4. convertNumberToBigDecimal(Number aNumber)
  5. doubleArrayToBigDecimalList( double[] array)
  6. doubleToBigDecimal(double dd)
  7. longToBigDecimal(long amountAsSatoshis)
  8. numberToBigDecimal(Number number)
  9. numberToBigDecimal(Number value)