如何从Java转换hex ip?

时间:2012-03-28 14:14:48

标签: ip converter

我使用cat /proc/pid/net/udp6并成为: sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops 63: 00000000000000000000000000000000:D9BF 00000000000000000000000000000000:0000 07 00000000:00000000 00:00000000 00000000 1000 0 181584 2 c16e8d00 0

我知道它的结构化和00000000000000000000000000000000:D9BF必须是本地IP。如何将其转换为普通的ip格式,如127.0.0.1?

1 个答案:

答案 0 :(得分:1)

InetAddress a = InetAddress.getByAddress(DatatypeConverter.parseHexBinary("0A064156"));