Java IP Address to String IPToString(int intIP)

Here you can find the source of IPToString(int intIP)

Description

IP To String

License

BSD License

Declaration

public static String IPToString(int intIP) 

Method Source Code

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

public class Main {
    public static String IPToString(int intIP) {
        StringBuilder sb = new StringBuilder(15);
        try {//from   ww  w . ja  v  a 2 s .  com
            for (int i = 3; i >= 0; i--) {
                if (i != 3)
                    sb.append('.');
                sb.append((int) (intIP & 0xFF));
                intIP = intIP >>> 8;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (sb.toString());
    }
}

Related

  1. ip2String(int ip)
  2. ipToIPv4Str(byte[] ip)
  3. ipToString(final byte[] address)
  4. ipToString(final byte[] bytes)
  5. IpToString(int address)
  6. ipToString(long ip)
  7. ipv4ToBinaryStr(int ipv4)
  8. ipV4ToLong(final String ipaddress)
  9. ipv4ToStr(int ipv4)