+ 1

How to double value without using any arithmetic operation

13th Feb 2019, 6:54 AM
Ganesh Chevale
Ganesh Chevale - avatar
2 odpowiedzi
+ 7
For integers: left shift by one. Not sure about Java, but in other languages it would look like this: n << 1
13th Feb 2019, 7:08 AM
Anna
Anna - avatar
+ 5
The same for Java; (2 << 1) == 4
13th Feb 2019, 8:07 AM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar