Java Integer to IP Address intToIP(int ipAddr)

Here you can find the source of intToIP(int ipAddr)

Description

int To IP

License

Open Source License

Declaration

public static final String intToIP(int ipAddr) 

Method Source Code

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

public class Main {

    public static final String intToIP(int ipAddr) {
        long ip = 0xFFFFFFFFL & ipAddr;
        String str = new Long(ip % 256).toString();
        str = "." + str;
        ip >>>= 8;/*from ww  w  . ja va  2 s.  co m*/

        str = new Long(ip % 256).toString() + str;
        str = "." + str;
        ip >>>= 8;

        str = new Long(ip % 256).toString() + str;
        str = "." + str;
        ip >>>= 8;

        str = new Long(ip % 256).toString() + str;
        return str;
    }
}

Related

  1. intToIp(int i)
  2. intToIp(int i)
  3. intToIp(int i)
  4. intToIP(int intIP)
  5. intToIp(int ip)
  6. intToIp(int ipInt)
  7. intToIpAddr(int ip)
  8. intToIpAddress(int i)
  9. intToIpString(int ip)