MCPcopy Create free account
hub / github.com/careercup/ctci / flip

Method flip

java/Chapter 17/Question17_4/Question.java:5–7  ·  view source on GitHub ↗
(int bit)

Source from the content-addressed store, hash-verified

3public class Question {
4 /* Flips a 1 to a 0 and a 0 to a 1 */
5 public static int flip(int bit) {
6 return 1 ^ bit;
7 }
8
9 /* Returns 1 if a is positive, and 0 if a is negative */
10 public static int sign(int a) {

Callers 3

signMethod · 0.95
getMaxNaiveMethod · 0.95
getMaxMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected