private static boolean isIPv4(String host){
  String regex="\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3}";
  return host.matches(regex);
}

private static boolean isIPv4 ( String host ) { String regex = "\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3}" ; return host . matches ( regex ) ; }
checks if the given host name is actually a string representation of an ipv4 address .
