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

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

	int n = name.compareTo(arg.name);
	if (n != 0)
		return (n);
	n = dclass - arg.dclass;
	if (n != 0)
		return (n);
	n = type - arg.type;
	if (n != 0)
		return (n);
	byte [] rdata1 = rdataToWireCanonical();
	byte [] rdata2 = arg.rdataToWireCanonical();
	for (int i = 0; i < rdata1.length && i < rdata2.length; i++) {
		n = (rdata1[i] & 0xFF) - (rdata2[i] & 0xFF);
		if (n != 0)
			return (n);
	}
	return (rdata1.length - rdata2.length);
}
Compares this Record to another Object.
@param o The Object to be compared.
@return The value 0 if the argument is a record equivalent to this record;
a value less than 0 if the argument is less than this record in the
canonical ordering, and a value greater than 0 if the argument is greater
than this record in the canonical ordering.  The canonical ordering
is defined to compare by name, class, type, and rdata.
@throws ClassCastException if the argument is not a Record.
src/main/java/core/org/xbill/DNS/Record.java