Java IP Address to String ipToString(final byte[] address)

Here you can find the source of ipToString(final byte[] address)

Description

Convert specified array of bytes into an ip-string.

License

Open Source License

Parameter

Parameter Description
address the address

Return

the ip address

Declaration

public static String ipToString(final byte[] address) 

Method Source Code

//package com.java2s;

public class Main {
    /**// www  .  ja  va  2s.c o m
     * Convert specified array of bytes into an ip-string.
     *
     * @param address the address
     * @return the ip address
     */
    public static String ipToString(final byte[] address) {
        final StringBuffer sb = new StringBuffer(address.length * 4);
        for (int i = 0; i < address.length; i++) {
            final int element = address[i] & 0xFF;
            if (0 != i) {
                sb.append('.');
            }
            sb.append(element);
        }
        return sb.toString();
    }
}

Related

  1. inputStreamContent(InputStream is)
  2. ip2string(byte[] ip)
  3. ip2string(byte[] ips)
  4. ip2String(int ip)
  5. ipToIPv4Str(byte[] ip)
  6. ipToString(final byte[] bytes)
  7. IpToString(int address)
  8. IPToString(int intIP)
  9. ipToString(long ip)