Created
July 25, 2014 23:19
-
-
Save jyhjuzi/70a45225c8a06007fb89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Q5_6{ | |
public static void main(String[] args){ | |
int test = 0b01011100110100010101001; | |
System.out.println(Integer.toBinaryString(swap(test))); | |
} | |
static int swap(int input){ | |
return ((input & 0x55555555) << 1) | ((input & 0xaaaaaaaa)>>1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment