Java tutorial
//package com.java2s; //License from project: Apache License import java.net.Inet4Address; import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static InetAddress ipIntToInet4Address(int ip) { byte[] ipAddress = new byte[4]; writeInt(ipAddress, 0, ip); try { return Inet4Address.getByAddress(ipAddress); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } public static void writeInt(byte[] data, int offset, int value) { data[offset] = (byte) (value >> 24); data[offset + 1] = (byte) (value >> 16); data[offset + 2] = (byte) (value >> 8); data[offset + 3] = (byte) (value); } }