public int compareTo(ByteBuffer otherBuffer) {int compareRemaining = (remaining() < otherBuffer.remaining()) ? remaining(): otherBuffer.remaining();int thisPos = position;int otherPos = otherBuffer.position;byte thisByte, otherByte;while (compareRemaining > 0) {thisByte = get(thisPos);otherByte = otherBuffer.get(otherPos);if (thisByte != otherByte) {return thisByte < otherByte ? -1 : 1;}thisPos++;otherPos++;compareRemaining--;}return remaining() - otherBuffer.remaining();}
public virtual int compareTo(java.nio.ByteBuffer otherBuffer){int compareRemaining = (remaining() < otherBuffer.remaining()) ? remaining() : otherBuffer.remaining();int thisPos = _position;int otherPos = otherBuffer._position;byte thisByte;byte otherByte;while (compareRemaining > 0){thisByte = get(thisPos);otherByte = otherBuffer.get(otherPos);if (thisByte != otherByte){return ((sbyte)thisByte) < otherByte ? -1 : 1;}thisPos++;otherPos++;compareRemaining--;}return remaining() - otherBuffer.remaining();}