Java Integer to IP Address int2IpAddressString(long i)

Here you can find the source of int2IpAddressString(long i)

Description

int Ip Address String

License

Apache License

Declaration

public static String int2IpAddressString(long i) 

Method Source Code

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

public class Main {
    public static String int2IpAddressString(long i) {
        long b0 = (i >> 24) & 0xff;
        long b1 = (i >> 16) & 0xff;
        long b2 = (i >> 8) & 0xff;
        long b3 = i & 0xff;

        StringBuilder sb = new StringBuilder();
        sb.append(b0).append(".");
        sb.append(b1).append(".");
        sb.append(b2).append(".");
        sb.append(b3);/*  w  ww.  j a va  2  s .com*/
        return sb.toString();
    }
}

Related

  1. int2ip(int ipInt)
  2. int2IP(long ip)
  3. Int2Ip(long ip)
  4. int2ipstr(int addr)
  5. int2IpStr(long ip)
  6. intToIp(int address)
  7. intToIp(int i)