private static boolean isIpAddress(String name){
  if (IPAddressUtil.isIPv4LiteralAddress(name) || IPAddressUtil.isIPv6LiteralAddress(name)) {
    return true;
  }
 else {
    return false;
  }
}

private static boolean isIpAddress ( String name ) { if ( IPAddressUtil . isIPv4LiteralAddress ( name ) || IPAddressUtil . isIPv6LiteralAddress ( name ) ) { return true ; } else { return false ; } }
test whether the given hostname looks like a literal ipv4 or ipv6 address . the hostname does not need to be a fully qualified name . this is not a strict check that performs full input validation . that means if the method returns true , name need not be a correct ip address , rather that it does not represent a valid dns hostname . likewise for ip addresses when it returns false .
