title: How to extract the first three segments of an IP address in android
body: <p>Example:</p>
  
  <p>xxx.xxx.xxx.xxx is an IP address format and I want to get only the first three segments (with dots): xxx.xxx.xxx.</p>
  
  <p>Another example: </p>
  
  <p>192.168.0.160 and I want only 192.168.0.</p>