Java的inet_aton inet_ntoa
来源:互联网 发布:淘宝关联销售模板 编辑:程序博客网 时间:2024/05/01 21:50
public static String inet_ntoa(long add) {return ((add & 0xff000000) >> 24) + "." + ((add & 0xff0000) >> 16)+ "." + ((add & 0xff00) >> 8) + "." + ((add & 0xff));}public static long inet_aton(Inet4Address add) {byte[] bytes = add.getAddress();long result = 0;for (byte b : bytes) {if ((b & 0x80L) != 0) {result += 256L + b;} else {result += b;}result <<= 8;}result >>= 8;return result;}/** * significantly faster than parse the string into long */public static long inet_aton(String add) {long result = 0;// number between a dotlong section = 0;// which digit in a numberint times = 1;// which sectionint dots = 0;for (int i = add.length() - 1; i >= 0; --i) {if (add.charAt(i) == '.') {times = 1;section <<= dots * 8;result += section;section = 0;++dots;} else {section += (add.charAt(i) - '0') * times;times *= 10;}}section <<= dots * 8;result += section;return result;}没有找到好的java版,在大规模使用的时候还是有些差距的。
- Java的inet_aton inet_ntoa
- MySQL的IP存储 INET_ATON INET_NTOA
- inet_aton,inet_ntoa,inet_addr,inet_network的细微区别
- inet_ntoa、 inet_aton、inet_addr
- Linux函数-inet_aton / inet_ntoa
- linux inet_aton inet_ntoa
- inet_ntoa(), inet_aton(), inet_addr
- inet_aton、inet_addr、inet_ntoa函数
- inet_ntoa、 inet_aton、inet_addr
- inet_ntoa、 inet_aton、inet_addr
- inet_ntoa、 inet_aton、inet_addr
- inet_ntoa、 inet_aton、inet_addr
- Mysql的IP处理函数inet_aton()和inet_ntoa()
- 利用mysql的inet_aton()和inet_ntoa()函数存储IP地址
- 利用mysql的inet_aton()和inet_ntoa()函数存储IP地址
- 利用mysql的inet_aton()和inet_ntoa()函数存储IP地址
- Mysql的IP处理函数inet_aton()和inet_ntoa()
- Mysql的IP处理函数inet_aton()和inet_ntoa()
- HDU 1242 Rescue(BFS +优先队列)
- python collections模块
- VS2005调试时如何解决“没有可用于当前位置的源代码”提示
- 图像处理中的梯度、导数如何求?(Robert算子,Sobel算子,Prewitt算子,Laplace算子)
- Embedded Remote Monitoring System Based on Internet
- Java的inet_aton inet_ntoa
- 深入 理解 Statement 和 PreparedStatement
- nchar,char,varchar与nvarchar区别
- 怒!
- sharepoint 2013 文档库eventhandle权限控制
- 基础知识1
- Linux ps 札记
- 安装Ecshop首页出现报错:Only variables should be passed by referen
- synchronized的使用总结