Java IP Address to Long ipv4(long ip)

Here you can find the source of ipv4(long ip)

Description

ipv

License

Apache License

Declaration

public static String ipv4(long ip) 

Method Source Code

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

public class Main {

    public static String ipv4(long ip) {
        StringBuilder ret = new StringBuilder();
        ret.insert(0, ip % 256).insert(0, ".");
        ip >>= 8;/*from w  w  w . j a  v  a2 s .  c  o m*/
        ret.insert(0, ip % 256).insert(0, ".");
        ip >>= 8;
        ret.insert(0, ip % 256).insert(0, ".");
        ip >>= 8;
        ret.insert(0, ip);
        return ret.toString();
    }
}

Related

  1. ipToLong(String ipAddress)
  2. ipToLong(String ipAddress)
  3. ipToLong(String ipStr)
  4. ipToLong(String sip)
  5. ipToLong(String strIP)
  6. ipV4AddressToLong(String ipAddress)
  7. ipv4CidrToLong(String networkCidr)
  8. ipV4ToLong(final String ipAddress)
  9. ipv4ToLong(final String ipv4)