Java BigDecimal from toBigDecimal(double val)

Here you can find the source of toBigDecimal(double val)

Description

to Big Decimal

License

Open Source License

Declaration

public static BigDecimal toBigDecimal(double val) 

Method Source Code


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

import java.math.BigDecimal;

public class Main {
    public static BigDecimal toBigDecimal(double val) {
        assert !Double.isNaN(val);
        assert !Double.isInfinite(val);
        return new BigDecimal(Double.toString(val));
    }/*  ww  w.  ja v  a2s .  com*/

    public static BigDecimal toBigDecimal(long val) {
        return new BigDecimal(val);
    }
}

Related

  1. numberToBigDecimal(Object number)
  2. numberToBigDecimal(Object obj)
  3. toBigDecimal(byte[] bytes)
  4. toBigDecimal(Double d)
  5. toBigDecimal(Double d)
  6. toBigDecimal(double[][] a)
  7. toBigDecimal(final byte value)
  8. toBigDecimal(final Double d)
  9. toBigDecimal(final Number n)