Java Long to IP Address longToIp(long ip)

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

Description

long To Ip

License

Apache License

Declaration

protected static String longToIp(long ip) 

Method Source Code

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

public class Main {
    protected static String longToIp(long ip) {
        StringBuilder sb = new StringBuilder(15);

        for (int i = 0; i < 4; i++) {
            sb.insert(0, Long.toString(ip & 0xff));

            if (i < 3) {
                sb.insert(0, '.');
            }/* w w  w  .j a  va  2s  . c om*/

            ip >>= 8;
        }

        return sb.toString();
    }
}

Related

  1. long2IP(long proper_address)
  2. long2IpAdress(long src)
  3. longToIp(long address)
  4. longToIp(long i)
  5. longToIp(long i)
  6. longToIp(long ip)
  7. LongToIp(long longIp)
  8. longToIp(long longValue)
  9. longToIp(String ip)