How can I convert BigInteger
value to BigDecimal
without using new
operator?
For instance, if I have an integer value like:
abc=4000.
I should get the output as:
xyz= 4000.0
use valueOf
if you mean that your own code should not use new
operator.
BigDecimal.valueOf(abc.longValue());
if abc
is a BigInteger
.
If you want to create the object without using new
in your code and in the code of the jre then you can not do it. BigDecimal.valueOf()
uses new to create a BigDecimal object.