How to use bit Operation instead of multiplication and Division in java
This article mainly introduces how java uses bit operation instead of multiplication and division, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.
Bit operation instead of multiplication and division
Of all the operations, bit operation is the most efficient. Therefore, we can try to use bit operations instead of partial arithmetic operations to improve the running speed of the system.
For example, bit operations are used in the source code of HashMap.
Static final int DEFAULT_INITIAL_CAPACITY = 1