Java IP Address to Int ipToInteger(String ip)

Here you can find the source of ipToInteger(String ip)

Description

ip To Integer

License

Open Source License

Declaration

public static int ipToInteger(String ip) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int ipToInteger(String ip) {
        final String[] ipBytesStr = ip.split("\\.");
        int ipValue = 0;
        for (int i = 0; i < 4; i++) {
            ipValue <<= 8;/*from ww w  .  ja  v a2  s .co m*/
            ipValue |= Integer.parseInt(ipBytesStr[i]);
        }
        return ipValue;
    }
}

Related

  1. ipToInt(String addr)
  2. ipToInt(String address)
  3. ipToInt(String ip)
  4. ipToInt(String ipAddr)
  5. IpToInt(String strIp)
  6. IPV4AddressStrToInteger(String ipAddressStr)
  7. IPV4AddressToInteger(byte[] addr)
  8. ipV4ToInt(String addr)
  9. ipv4ToInt(String addr)