public byte[] asBytes(String addr) {// Convert the TCP/IP address string to an integer valueint ipInt = parseNumericAddress(addr);if (ipInt == 0)return null;// Convert to bytesbyte[] ipByts = new byte[4];ipByts[3] = (byte) (ipInt & 0xFF);ipByts[2] = (byte) ((ipInt >> 8) & 0xFF);ipByts[1] = (byte) ((ipInt >> 16) & 0xFF);ipByts[0] = (byte) ((ipInt >> 24) & 0xFF);// Return the TCP/IP bytesreturn ipByts;}
沒有留言:
張貼留言