Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the use of Long.reverse(long ) method?

I found one method in Long class

public static long reverse(long i) {..}

What is the use of this method?

like image 216
DKSRathore Avatar asked Dec 10 '09 16:12

DKSRathore


1 Answers

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.

like image 84
Lucero Avatar answered Oct 10 '22 17:10

Lucero