![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
网络编程
文章平均质量分 63
_jonny
这个作者很懒,什么都没留下…
展开
-
高字节序与低字节序的转换
public class FormatTransfer {/*** 将int转为低字节在前,高字节在后的byte数组* @param n int* @return byte[]*/public static byte[] toLH(int n) {byte[] b = new byte[4];b[0] = (byte) (n & 0xff);b[1] = (by原创 2014-05-09 18:11:05 · 1229 阅读 · 0 评论 -
ip 主机字节序 网络字节序转换
本文介绍IP地址与网络字节序和主机字节序的相互转换的实现:用IP地址127.0.0.1为例:第一步 127 . 0 . 0 . 1 把IP地址每一部分转换为8位的二进制数。第二步 01111111 00000000 00000000 00000001 = 2130706433 (主机字节序)String ip="127.0.0.1";String ipArray[]=ip.原创 2014-05-09 18:09:10 · 1698 阅读 · 0 评论