Here you can find the source of longToIPv4(Long ip)
public static String longToIPv4(Long ip)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; public class Main { public static String longToIPv4(Long ip) { ByteBuffer buffer = ByteBuffer.allocate(Integer.SIZE / 8); buffer.putInt(ip.intValue());//from w ww .j a va 2 s.c o m try { InetAddress addr = InetAddress.getByAddress(buffer.array()); return addr.getHostAddress(); } catch (UnknownHostException e) { return null; } } }