Here you can find the source of longToIp(long longValue)
public static String longToIp(long longValue)
//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()); } }