• Post Reply Bookmark Topic Watch Topic
  • New Topic

I need help with reminder  RSS feed

 
Salim Almutairi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I wanna to know how to do division with reminder
Presented as xry where x is result of the division
And y is the remainder like 9 % 3 = 9r3
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!
There's no single operator that will give you a result like this, but there are standard API facilities that can get you a result close to it.
The BigInteger and BigDecimal classes both provide divideAndRemainder() methods that will return an array containing both quotient and remainder.
All you'd have to do is turn that result into the String representation you want, which should be pretty easy.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!