@Test public void shouldValidate() { assertTrue(IPv4ToolSet.isValid("192.168.3.51")); assertTrue(IPv4ToolSet.isValid("127.0.0.1")); assertTrue(IPv4ToolSet.isValid("10.0.0.1")); assertTrue(IPv4ToolSet.isValid("172.17.10.255")); }
public static boolean isValid(String ip) { long ipLong; if(ip==null) { return false; } try { ipLong = ip2long(ip); } catch (IPStringException ex) { return false; } return true; }
IPv4ToolSet { public static boolean isValid(String ip) { long ipLong; if(ip==null) { return false; } try { ipLong = ip2long(ip); } catch (IPStringException ex) { return false; } return true; } }
IPv4ToolSet { public static boolean isValid(String ip) { long ipLong; if(ip==null) { return false; } try { ipLong = ip2long(ip); } catch (IPStringException ex) { return false; } return true; }  }
IPv4ToolSet { public static boolean isValid(String ip) { long ipLong; if(ip==null) { return false; } try { ipLong = ip2long(ip); } catch (IPStringException ex) { return false; } return true; }  static String long2ip(long ipLong); static long mask_bits(int bits); static List<String> ipv4BlockToIpStrings(String blockString); static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks); static IPv4Range ipv4BlockToRange(String blockString); static boolean isValid(String ip); static long ip2long(String ip); static boolean rejectUnwantedIps(String ip); }
IPv4ToolSet { public static boolean isValid(String ip) { long ipLong; if(ip==null) { return false; } try { ipLong = ip2long(ip); } catch (IPStringException ex) { return false; } return true; }  static String long2ip(long ipLong); static long mask_bits(int bits); static List<String> ipv4BlockToIpStrings(String blockString); static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks); static IPv4Range ipv4BlockToRange(String blockString); static boolean isValid(String ip); static long ip2long(String ip); static boolean rejectUnwantedIps(String ip);  }