getAddress方法和getHostAddress類似
public byte[] getAddress()
這個方法返回的byte數組是有符號的
package mynet;
import java
public class MyIP
{
public static void main(String[] args) throws Exception
{
InetAddress address = InetAddress
byte ip[] = address
for (byte ipSegment : ip)
System
System
for (byte ipSegment : ip)
{
int newIPSegment = (ipSegment <
System
}
}
}
運行結果
從上面的運行結果可以看出
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20504.html