public int compareTo(Object o) { if (o == this) { return 0; } if (o instanceof ByteArray) { ByteArray rhs = (ByteArray) o; return ArrayUtils.compareTo(bytea, rhs.bytea); } throw new IllegalArgumentException("Uncomparable: " + o.getClass().getName()); }