### Question:
IPUtils { public static int nibble2int(byte nibble) { int out; switch (nibble) { case '0': out = 0; break; case '1': out = 1; break; case '2': out = 2; break; case '3': out = 3; break; case '4': out = 4; break; case '5': out = 5; break; case '6': out = 6; break; case '7': out = 7; break; case '8': out = 8; break; case '9': out = 9; break; case 'a': out = 10; break; case 'b': out = 11; break; case 'c': out = 12; break; case 'd': out = 13; break; case 'e': out = 14; break; case 'f': out = 15; break; case 'A': out = 10; break; case 'B': out = 11; break; case 'C': out = 12; break; case 'D': out = 13; break; case 'E': out = 14; break; case 'F': out = 15; break; default: out = -1; break; } return out; }  static Integer rndInt(int lo, int hi); static Double rndDouble(double lo, double hi); static Integer rndPosInt(int lo, int hi); static String rndIp(); static Object rndChoice(List oList); static Object rndChoice(Object[] oArray); static String rndperc(); static final int ubyte2int(byte in); static final byte int2ubyte(int in); static boolean isValidIpv6String(String in); static final boolean isValidIpv4Subnet(String in); static boolean isValidIpv6Subnet(String in); static boolean isValidIpv4String(String in); static int nibble2int(byte nibble); static final byte int2nibble(int in); static String int16bit2hex(int i16); static int hex16bit2int(String in); static boolean IP4RegEx(String ip); static boolean IP6RegEx(String ip); static boolean IPRegEx(String ip);  }### Answer:
@Test public void nibble2int() { assertEquals(IPUtils.nibble2int((byte) 'f'), 15); assertEquals(IPUtils.nibble2int((byte) 'F'), 15); assertEquals(IPUtils.nibble2int((byte) 'X'), -1); assertEquals(IPUtils.nibble2int((byte) '0'), 0); assertEquals(IPUtils.nibble2int((byte) '7'), 7); }