Here you can find the source of ipv4(long ip)
public static String ipv4(long ip)
//package com.java2s; //License from project: Apache License public class Main { public static String ipv4(long ip) { StringBuilder ret = new StringBuilder(); ret.insert(0, ip % 256).insert(0, "."); ip >>= 8;/*from w w w . j a v a2 s . c o m*/ ret.insert(0, ip % 256).insert(0, "."); ip >>= 8; ret.insert(0, ip % 256).insert(0, "."); ip >>= 8; ret.insert(0, ip); return ret.toString(); } }