There may be shorter.
See http://stackoverflow.com/questions/5667371/validate-ipv4-address-in-java

return ip != null && ip.matches( IP_PATTERN );