title: How calculate next IP adress having ip in bit representation?
body: <p>I get IP address form DHCP info. How calculate next IP address when I have IP in bit representation.</p>
  
  <pre><code>WifiManager wifii = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
  DhcpInfo d = wifii.getDhcpInfo();
  int mask = d.netmask;
  int ip0 = d.ipAddress &amp; d.netmask;
  int num = ~d.netmask; //it should be correct but don't work. why?
  
  //this don't work. How make it correct?
  for(int ip = ip0; ip &lt; ip + num; ip++){
     //here ip next ip
  }
  </code></pre>