通过InetAddress 获取字节数组IP时 byte[] bytes = address.getAddress();,出现负数
InetAddress address = InetAddress.getLocalHost();
System.out.println("主机ip地址:"+address.getHostAddress());
System.out.println("主机名称:"+address.getHostName());
byte[] bytes = address.getAddress();
System.out.println("字节数组型的IP地址"+Arrays.toString(bytes));
输出:
主机ip地址:192.168.119.35
主机名称:WIN-R5PAKVOQ0S5
字节数组型的IP地址[-64, -88, 119, 35]
问题:
字节数组型的IP地址[-64, -88, 119, 35]
为什么会出现 -64 -88 现象