Java IP Address to Long ip2Long(String ipAddress)

Here you can find the source of ip2Long(String ipAddress)

Description

ip Long

License

Apache License

Declaration

public static long ip2Long(String ipAddress) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static long ip2Long(String ipAddress) {
        String[] ipAddressInArray = ipAddress.split("[.]");

        long result = 0;

        for (int i = 3; i >= 0; i--) {
            long ip = Long.parseLong(ipAddressInArray[3 - i]);
            result |= ip << (i * 8);
        }/*from  w  ww .  j a  va2 s .  c om*/

        return result;
    }
}

Related

  1. ip2Long(String ip)
  2. ip2long(String ip)
  3. ip2long(String ip)
  4. ip2long(String ip)
  5. ip2Long(String ip)
  6. ip2Long(String ipaddress)
  7. ipToLong(byte[] address)
  8. ipToLong(byte[] octets)
  9. ipToLong(final String addr)