I'm having a hard time figuring out how to convert this. Here is what I want:
int i = 5900;
BigDecimal bD = new BigDecimal(i);
I need bD to be 59.00 but I can't figure out how to get this result. All I've been able to get is 5900 as type BigDecimal. Any suggestion would help, thanks.
You haven't been very specific about the semantics you want, but it looks like
BigDecimal.valueOf(i).movePointLeft(2)
does what you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.