I found one method in Long class
public static long reverse(long i) {..}
What is the use of this method?
I found one method in Long class
public static long reverse(long i) {..}
What is the use of this method?
From an DDJ article:
Why would you reverse the order of bits in a 32-bit or 64-bit value? Bit reversal can be useful in a variety of contexts. It's useful in image processing for flipping a black-and-white image to create a mirror image. To flip an image horizontally, the pixels in a row of the image must be placed in reverse order. Fast 64-bit bit reversal can be used in the process of reversing a row of black-and-white pixels. Similarly, 64-bit bit reversal is useful for rotating a black and white image 180 degrees.
Apparently bit reversal is used in digital signal processing applications, as in the Fast Fourier Transform. I won't pretend to understand why it works, but perhaps the linked-to page will be clear to you.
You can use bit reversal to make it easier to work with masking operations.