public int
compareTo(Object o) {
	Name arg = (Name) o;

	if (this == arg)
		return (0);

	int labels = labels();
	int alabels = arg.labels();
	int compares = labels > alabels ? alabels : labels;

	for (int i = 1; i <= compares; i++) {
		int start = offset(labels - i);
		int astart = arg.offset(alabels - i);
		int length = name[start];
		int alength = arg.name[astart];
		for (int j = 0; j < length && j < alength; j++) {
			int n = lowercase[(name[j + start + 1]) & 0xFF] -
				lowercase[(arg.name[j + astart + 1]) & 0xFF];
			if (n != 0)
				return (n);
		}
		if (length != alength)
			return (length - alength);
	}
	return (labels - alabels);
}
Compares this Name to another Object.
@param o The Object to be compared.
@return The value 0 if the argument is a name equivalent to this name;
a value less than 0 if the argument is less than this name in the canonical 
ordering, and a value greater than 0 if the argument is greater than this
name in the canonical ordering.
@throws ClassCastException if the argument is not a Name.
src/main/java/core/org/xbill/DNS/Name.java