code: public static InetAddress getIPHostAddress(String host) {
          InetAddress result = null;
          Matcher matcher = IPV4_QUADS.matcher(host);
          if (matcher == null || !matcher.matches()) {
              return result;
          }
          try {
              // Doing an Inet.getByAddress() avoids a lookup.
              result = InetAddress.getByAddress(host,
                      new byte[] {
                      (byte)(new Integer(matcher.group(1)).intValue()),
                      (byte)(new Integer(matcher.group(2)).intValue()),
                      (byte)(new Integer(matcher.group(3)).intValue()),
                      (byte)(new Integer(matcher.group(4)).intValue())});
          } catch (NumberFormatException e) {
              logger.warning(e.getMessage());
          } catch (UnknownHostException e) {
              logger.warning(e.getMessage());
          }
          return result;
      }
docs: Returns InetAddress for passed <code>host</code> IF its in
  IPV4 quads format (e.g. 128.128.128.128).
  <p>TODO: Move to an AddressParsingUtil class.
  @param host Host name to examine.
  @return InetAddress IF the passed name was an IP address, else null.