Another good option for processing IPs is to use Java's classes Inet4Address and Inet6Address, which can be useful in a number of ways, one of which is to determine the validity of the IP address.
I know this doesn't answer the question directly, but just thought it's worth mentioning.