public static Name
fromAddress(byte [] addr) {
	if (addr.length != 4 && addr.length != 16)
		throw new IllegalArgumentException("array must contain " +
						   "4 or 16 elements");

	StringBuffer sb = new StringBuffer();
	if (addr.length == 4) {
		for (int i = addr.length - 1; i >= 0; i--) {
			sb.append(addr[i] & 0xFF);
			if (i > 0)
				sb.append(".");
		}
	} else {
		int [] nibbles = new int[2];
		for (int i = addr.length - 1; i >= 0; i--) {
			nibbles[0] = (addr[i] & 0xFF) >> 4;
			nibbles[1] = (addr[i] & 0xFF) & 0xF;
			for (int j = nibbles.length - 1; j >= 0; j--) {
				sb.append(Integer.toHexString(nibbles[j]));
				if (i > 0 || j > 0)
					sb.append(".");
			}
		}
	}

	try {
		if (addr.length == 4)
			return Name.fromString(sb.toString(), inaddr4);
		else
			return Name.fromString(sb.toString(), inaddr6);
	}
	catch (TextParseException e) {
		throw new IllegalStateException("name cannot be invalid");
	}
}
Creates a reverse map name corresponding to an address contained in
an array of 4 bytes (for an IPv4 address) or 16 bytes (for an IPv6 address).
@param addr The address from which to build a name.
@return The name corresponding to the address in the reverse map.
src/main/java/core/org/xbill/DNS/ReverseMap.java