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);