title: Java - How to detect IP version
body: <p>I'm getting <code>Client</code> IP address via below method :</p>
  
  <pre><code>public static String getClientIpAddr(HttpServletRequest request) {  
      String ip = request.getHeader("X-Forwarded-For");  
      ...
      return ip
  } 
  </code></pre>
  
  <p>Now I want to detect if it is an <code>IPV4</code> or an <code>IPV6</code>.</p>