Java InetAddress.getByAddress()的使用
2015-01-29 11:48
441 查看
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); } }转自:/article/6959335.html
相关文章推荐
- Java InetAddress.getByAddress()的使用
- Java InetAddress.getByAddress()的使用
- InetAddress.getLocalHost() java.net.UnknownHostException 异常
- java点滴之InetAddress类和InetSocketAddress的使用
- InetAddress.getByAddress(byte[] arr)源码解析
- java点滴之InetAddress类和InetSocketAddress的使用
- java InetAddress基本使用
- java.net.InetAddress.getLocalHost(InetAddress.java:1473) java.net.Unknown
- java InetAddress.getLocalHost().getHostAddress() 获取本机真实IP
- java点滴之InetAddress类和InetSocketAddress的使用
- java之InetAddress类和InetSocketAddress的使用
- JAVA学习笔记-----------InetAddress 的有关IP地址的使用案例(杂乱)
- at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
- java.net.InetAddress的使用
- java InetAddress.getLocalHost() 在linux里实现
- java之InetAddress的使用
- Centos7下JAVA: InetAddress.getLocalHost().getHostAddress()报错
- [Trouble Shoot]在使用hibernate-validator-4.0.2.GA时遇到的java.lang.NoSuchMethodError: javax.persistence.Persistence.getPersistenceUtil(
- Blackboard problem: InetAddress.getLocalHost always returns "localhost"
- 使用Java发送POST、GET请求