JAVA 长整型转换为IP地址的方法
代码例如以下:
/**
* 整型解析为IP地址
* @param num
* @return
*/
public static String int2iP(Long num)
{
String str = null;
Long[] tt = new Long[4];
tt[0] = (num >>> 24) >>> 0;
tt[1] = ((num << 8) >>> 24) >>> 0;
tt[2] = (num << 16) >>> 24;
tt[3] = (num << 24) >>> 24;
str = (tt[0]) + "." + (tt[1]) + "." + (tt[2]) + "." + (tt[3]);
return str;
}