I'm using a BigDecimal
variable in my application calculation. In some cases when the Bigdecimal
value is 2.9922 and I save data to SQL Server 2012, I get a 2.99 record in DB. Such rounding is OK for me but sometimes I need to compare records in the DB with a new calculation and I need them to have same rounding method.
So my question is what is the rounding method in Java that will be identical to SQL server 2012 rounding method?
Is it BigDecimal.ROUND_DOWN
or BigDecimal.ROUND_UP
, ROUND_HALF_EVEN
or which one?