code: private static boolean isIPAdressValid(final String ip){
  
          // InetAddress.getByName() validates 'null' as a valid IP (localhost).
          // we do not want that
          if (hasValue(ip)) {
              return IP_ADDR_PATTERN.matcher(ip).matches();
          }
          return false;
      }
docs: Simple validation, using java.net.InetAddress.getByName().
  
  @param ip the IP address string to check
  
  @return true for a valid IP address