Android Long Bit Shift flip32(long num)

Here you can find the source of flip32(long num)

Description

for switching big/small endian

Parameter

Parameter Description
num a parameter

Return

flipped representation.

Declaration

public static long flip32(long num) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from  w  w w.  ja v a2s.c o  m*/
     * for switching big/small endian
     * @param num
     * @return flipped representation.
     */
    public static long flip32(long num) {
        long tmp = num;
        tmp = ((tmp & 0x000000FF) << 24) + ((tmp & 0x0000FF00) << 8)
                + ((tmp & 0x00FF0000) >> 8) + ((tmp & 0xFF000000) >> 24);

        return tmp;
    }
}

Related

  1. isPowerOfTwo(long n)
  2. swap(long x)
  3. isPowerOfTwo(long v)