Java IP Address to Int ipv4ToInt(String address)

Here you can find the source of ipv4ToInt(String address)

Description

ipv To Int

License

Open Source License

Declaration

public static int ipv4ToInt(String address) 

Method Source Code

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

public class Main {
    public static int ipv4ToInt(String address) {
        String[] p = address.split("[.]");
        return (Integer.parseInt(p[0]) << 24) | (Integer.parseInt(p[1]) << 16) | (Integer.parseInt(p[2]) << 8)
                | (Integer.parseInt(p[3]));
    }// w  ww .j  a  v a2s . c  om
}

Related

  1. ipToInteger(String ip)
  2. IPV4AddressStrToInteger(String ipAddressStr)
  3. IPV4AddressToInteger(byte[] addr)
  4. ipV4ToInt(String addr)
  5. ipv4ToInt(String addr)