java.lang.Object Warmup
public class Warmup
A set of static methods you need to implement for this Java warmup. These method all involve integer parameters, and many require you to perform operations such as division and reminder. Using bit operations (shifting and masking) is useful for several, although not strictly needed. Do not change the method names or arguments. If you do, the tests will fail. In each method, replace the "throw new Unsupported..." statement with your implementation. Those throw statements are there to indicate which functions you haven't gotten around to implementing yet.
Method Summary | |
---|---|
static int |
bitCount(int x)
Return the number of 1 bits in the binary representation of x |
static int |
distinctValues(int x,
int y,
int z)
Return the number of distinct values passed as arguments |
static int |
firstDigit(int x)
Return the first digit of the base ten representation of x; will only return 0 if x == 0 |
static boolean |
isOdd(int x)
Return true if x is odd |
Method Detail |
---|
public static boolean isOdd(int x)
public static int firstDigit(int x)
public static int distinctValues(int x, int y, int z)
public static int bitCount(int x)