Bigdecimal does not allow 3 boxes after comma

Asked

Viewed 271 times

1

Guys, I’m making a division between 2 Bigdecimal and I need the system to not allow 3 houses after the comma. I have a full amount and I need to divide it by the amount informed by the user. if you go to your homes after the comma means that it worked, if you give 3 houses means that the user fills the wrong value, you have to do this validation at the time of dividing using Bigdecimal?

  • Have you tried using setScale?

  • but the setScale, case 3 houses it will not round to two?

  • Yeah, I didn’t quite understand your question, now that I read it again I sort of understood what you want.

  • See if this can help: http://stackoverflow.com/questions/10899429/how-do-i-validate-precision-and-scale-with-bigdecimal

  • thank you was that same that would like ".. Scale()"

  • For nothing, if you managed to solve the solution post, this way you help other people with the same problem. p

Show 1 more comment

1 answer

0


Conforms techies help to catch the house amount after the comma use bigDecimal.Cale()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.