private static final byte []
checkAndConvertAddress(String address) {
	if (!address.substring(0, 2).equalsIgnoreCase("0x")) {
		return null;
	}
	ByteArrayOutputStream bytes = new ByteArrayOutputStream();
	boolean partial = false;
	int current = 0;
	for (int i = 2; i < address.length(); i++) {
		char c = address.charAt(i);
		if (c == '.') {
			continue;
		}
		int value = Character.digit(c, 16);
		if (value == -1) {
			return null;
		}
		if (partial) {
			current += value;
			bytes.write(current);
			partial = false;
		} else {
			current = value << 4;
			partial = true;
		}

	}
	if (partial) {
		return null;
	}
	return bytes.toByteArray();
}
NSAP Address Record.

@author Brian Wellington
src/main/java/core/org/xbill/DNS/NSAPRecord.java