Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Hexadecimal and long in Java

Today I encountered a hexadecimal operation problem when I was implementing a bit reverse function for integer type. Basically in the implementation, there is an operation which is to do the bit operation & between one long integer and a hexadecimal number 0x00000000FFFFFFFFF. I was expecting that the high 32 bits of the long integer will be zeroed. But unfortunately I didn't get the expected result.The basic implementation is:long num=0x00F0_0000;num = (num>>16) | (num<<16); //Here the result will be 0x000000F0000000F0num = num & 0x00000000_FFFFFFFF;System.out.println("...

4,590 0       JAVA HEXADECIMAL LONG BITWISE OPERATION