Here you can find the source of long2ip(long ipLong)
public static String long2ip(long ipLong)
//package com.java2s; public class Main { public static String long2ip(long ipLong) { // long ipLong = 1037591503; long mask[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }; long num = 0; StringBuffer ipInfo = new StringBuffer(); for (int i = 0; i < 4; i++) { num = (ipLong & mask[i]) >> (i * 8); if (i > 0) ipInfo.insert(0, "."); ipInfo.insert(0, Long.toString(num, 10)); }/*from w ww .j a va 2s . c o m*/ return ipInfo.toString(); } }