Java InetAddress.getByAddress()的使用
2012-10-29 12:01
405 查看
import java.net.*; public class NetDemo { public static void main(String[] args) throws Exception{ String str = "172.20.223.120"; String[] ipStr = str.split("\\."); byte[] ipBuf = new byte[4]; for(int i = 0; i < 4; i++){ ipBuf[i] = (byte)(Integer.parseInt(ipStr[i])&0xff); } InetAddress ia = InetAddress.getByAddress("hao.wen",ipBuf); System.out.println(ia); } }
相关文章推荐
- Java InetAddress.getByAddress()的使用
- Java InetAddress.getByAddress()的使用
- java InetAddress.getLocalHost() 在linux里实现
- java之InetAddress类和InetSocketAddress的使用
- java.net.InetAddress的使用
- java InetAddress基本使用
- InetAddress.getByAddress(byte[] arr)源码解析
- java InetAddress.getLocalHost().getHostAddress() 获取本机真实IP
- java点滴之InetAddress类和InetSocketAddress的使用
- java之InetAddress的使用
- java点滴之InetAddress类和InetSocketAddress的使用
- java点滴之InetAddress类和InetSocketAddress的使用
- InetAddress.getLocalHost() java.net.UnknownHostException 异常
- java.net.InetAddress.getLocalHost(InetAddress.java:1473) java.net.Unknown
- at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
- JAVA学习笔记-----------InetAddress 的有关IP地址的使用案例(杂乱)
- Centos7下JAVA: InetAddress.getLocalHost().getHostAddress()报错
- InetAddress.getLocalHost()详解及异常处理
- GetProcAddress 使用注意事项
- Spark使用小结:Java版的GroupByKey示例