Does java have a divmod statement?

Besides the fact that divmod is a native instruction on many chipsets, it is also much easier for the eyes when dividing a number into several different names

(what happens, for example, with milliseconds → conversion of date or time, or cents → conversion of coin face value).

So, is there a divmod that returns both division and remainder results at the same time?

+5
source share
1 answer

Java is implemented for BigInteger or BigDecimal. They are intended for really huge integers and decimal numbers, not extreme efficiency.

Low-level optimization is not the power of Java, so I would recommend abandoning Java. You can make an algorithm in C or even use Assembler. Then, if you need to use it in a Java application, you can always make it a library. Then using the Java Native Interface, you can use the library in your application.

+2
source

Source: https://habr.com/ru/post/1272842/


All Articles