Here you can find the source of getInetAddress(long ip)
public static InetAddress getInetAddress(long ip)
//package com.java2s; //License from project: Open Source License import java.net.InetAddress; public class Main { private static byte[] ipWorkBytes = new byte[4]; public static InetAddress getInetAddress(long ip) { synchronized (ipWorkBytes) { byte[] ipBytes = ipWorkBytes; long ipAdd = ip; ipBytes[0] = (byte) (ipAdd >> 24); ipBytes[1] = (byte) (ipAdd >> 16); ipBytes[2] = (byte) (ipAdd >> 8); ipBytes[3] = (byte) (ipAdd); try { return InetAddress.getByAddress(ipBytes); } catch (Exception e) { return null; }/*from w w w . j av a2s. c o m*/ } } }