Last active
December 23, 2015 16:39
-
-
Save wszdwp/6663212 to your computer and use it in GitHub Desktop.
Cracking the interview 19.4
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 Question194 | |
{ | |
public static int getMax(int a, int b) { | |
int c = a - b; | |
int k = ( c >> 31) & 0x1; | |
return a - k * c; | |
} | |
public static void main(String[] args) { | |
int a = 5; | |
int b = 6; | |
System.out.println("Expected(6):" + getMax(a, b) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment