字符串到整数:
int pack(byte[] bytes) { int val = 0; for (int i = 0; i < bytes.length; i++) { val <<= 8; val |= bytes[i] & 0xff; } return val;}pack(InetAddress.getByName(dottedString).getAddress());整数到字符串:
byte[] unpack(int bytes) { return new byte[] { (byte)((bytes >>> 24) & 0xff), (byte)((bytes >>> 16) & 0xff), (byte)((bytes >>> 8) & 0xff), (byte)((bytes ) & 0xff) };}InetAddress.getByAddress(unpack(packedBytes)).getHostAddress()


