Java Integer to IP Address int2IP(long ip)

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

Description

int IP

License

Open Source License

Parameter

Parameter Description
i a parameter

Declaration

public static String int2IP(long ip) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   ww  w .j  av  a 2  s. c o m*/
     * @param i
     * @return
     */
    public static String int2IP(long ip) {
        StringBuffer sb = new StringBuffer(15);
        for (int shift = 24; shift > 0; shift -= 8) {
            // process 3 bytes, from high order byte down.
            sb.append(Long.toString((ip >>> shift) & 0xff));
            sb.append('.');
        }
        sb.append(Long.toString(ip & 0xff));
        return sb.toString();
    }
}

Related

  1. int2ip(int ipInt)
  2. Int2Ip(long ip)
  3. int2IpAddressString(long i)
  4. int2ipstr(int addr)
  5. int2IpStr(long ip)