Reverse and rotate a long value

ReturnMethodSummary
static longreverse(long i)Reversing the order of the bits.
static longreverseBytes(long i)Reversing the order of the bytes.
static longrotateLeft(long i, int distance)Rotating the binary long value left by distance.
static longrotateRight(long i, int distance)Rotating the binary long value right by distance.

public class Main {
  public static void main(String[] args) {
    System.out.println(Long.reverse(123123));
  }
}

The output:


-3528711045533138944
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.