### Question:
NetUtil { public static boolean isValidIpV4Address(String value) { int periods = 0; int i; int length = value.length(); if (length > 15) { return false; } char c; StringBuilder word = new StringBuilder(); for (i = 0; i < length; i++) { c = value.charAt(i); if (c == '.') { periods++; if (periods > 3) { return false; } if (word.length() == 0) { return false; } if (Integer.parseInt(word.toString()) > 255) { return false; } word.delete(0, word.length()); } else if (!Character.isDigit(c)) { return false; } else { if (word.length() > 2) { return false; } word.append(c); } } if (word.length() == 0 || Integer.parseInt(word.toString()) > 255) { return false; } if (periods != 3) { return false; } return true; } private  NetUtil(); static byte[] createByteArrayFromIpAddressString(
            String ipAddressString); static boolean isValidIpV6Address(String ipAddress); static boolean isValidIp4Word(String word); static boolean isValidIpV4Address(String value);  }### Answer:
@Test public void testIsValidIpV4Address() { for (String host : validIpV4Hosts.keySet()) { assertTrue(NetUtil.isValidIpV4Address(host)); } for (String host : invalidIpV4Hosts.keySet()) { assertFalse(NetUtil.isValidIpV4Address(host)); } }