Java Long to IP Address longToIp(long longValue)

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

Description

long To Ip

License

Apache License

Declaration

public static String longToIp(long longValue) 

Method Source Code

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

public class Main {
    public static String longToIp(long longValue) {
        int[] byteIPAddress = { 0, 0, 0, 0 };
        for (int i = 3; i >= 0; i--) {
            byteIPAddress[i] = (int) (longValue % 256);
            longValue = longValue >> 8;
        }//w  ww  . j  a va  2  s .co  m
        String returnValue = new String(
                byteIPAddress[0] + "." + byteIPAddress[1] + "." + byteIPAddress[2] + "." + byteIPAddress[3]);
        return returnValue;
    }

    public static String longToIp(Long longValue) {
        return longToIp(longValue.longValue());
    }
}

Related

  1. longToIp(long i)
  2. longToIp(long i)
  3. longToIp(long ip)
  4. longToIp(long ip)
  5. LongToIp(long longIp)
  6. longToIp(String ip)
  7. longToIpAddress(long ip)
  8. longToIPv4(final long ipaddress)
  9. longToIpV4(long ip)