Java IP Address to Int ipToInt(String address)

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

Description

ip To Int

License

Open Source License

Declaration

public static int ipToInt(String address) 

Method Source Code

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

public class Main {
    public static int ipToInt(String address) {
        String[] nibbles = address.split("\\.");

        int result = Integer.parseInt(nibbles[0]) << 24;
        result |= Integer.parseInt(nibbles[1]) << 16;
        result |= Integer.parseInt(nibbles[2]) << 8;
        result |= Integer.parseInt(nibbles[3]);

        return result;
    }/*from  ww  w.ja v a  2 s . c  o  m*/
}

Related

  1. ip2int(String ip)
  2. IP2Int(String ip)
  3. ip2int(String ipAddr)
  4. ipToInt(final String addr)
  5. ipToInt(String addr)
  6. ipToInt(String ip)
  7. ipToInt(String ipAddr)
  8. IpToInt(String strIp)
  9. ipToInteger(String ip)