IP转换hash以及返回

 InetAddress address = InetAddress.getByName("127.0.0.1");
            System.out.println(address);
            int h = address.hashCode();
			System.out.println(h);
            byte[] bytes = new byte[]{(byte) (h >> 24), (byte) (h >> 16), (byte) (h >> 8), (byte) h};
            InetAddress address2 = InetAddress.getByAddress(bytes);
            System.out.println(address2);

  

posted @ 2016-10-21 17:33  吐槽村  阅读(1024)  评论(0编辑  收藏  举报