I have to transfer some function from java code to Python. but the bit shift left return different result. And Python lack of the >>> operator in java
how to make them same? Python : 6116937115306182825 << 11 = 12527487212147062425600
java : 6116937115306182825 << 11 = 2147986098276878336
java has a limited number of bits(64) whereas python doesn't ... so you need to force it to the right number of bits(64)
(6116937115306182825 << 11) & 0xFFFFFFFFFFFFFFFF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With