Java IP Address to Long ip2long(String ip)

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

Description

iplong

License

Open Source License

Declaration

public static Long ip2long(String ip) 

Method Source Code

//package com.java2s;

public class Main {
    public static Long ip2long(String ip) {
        String[] arrStr = ip.split("\\.");
        if (arrStr.length != 4)
            throw new IllegalArgumentException("Wrong IP address");
        Long longIP = Long.parseLong(arrStr[0]) * 256 * 256 * 256 + Long.parseLong(arrStr[1]) * 256 * 256
                + Long.parseLong(arrStr[2]) * 256 + Long.parseLong(arrStr[3]);
        return longIP;
    }/* w w  w. jav  a 2 s .  co  m*/
}

Related

  1. convertIPS2Long(String ip)
  2. convertIpString2Long(String IP)
  3. ip2Long(final String ip)
  4. ip2long(String ip)
  5. ip2long(String ip)
  6. ip2Long(String ip)
  7. ip2long(String ip)
  8. ip2long(String ip)
  9. ip2long(String ip)