text: public int compareTo(LongBuffer otherBuffer) {int compareRemaining = (remaining() < otherBuffer.remaining()) ? remaining(): otherBuffer.remaining();int thisPos = position;int otherPos = otherBuffer.position;long thisLong, otherLong;while (compareRemaining > 0) {thisLong = get(thisPos);otherLong = otherBuffer.get(otherPos);if (thisLong != otherLong) {return thisLong < otherLong ? -1 : 1;}thisPos++;otherPos++;compareRemaining--;}return remaining() - otherBuffer.remaining();}