public int compareTo(IntBuffer otherBuffer){
  int compareRemaining=(remaining() < otherBuffer.remaining()) ? remaining() : otherBuffer.remaining();
  int thisPos=position;
  int otherPos=otherBuffer.position;
  int thisInt, otherInt;
  while (compareRemaining > 0) {
    thisInt=get(thisPos);
    otherInt=otherBuffer.get(otherPos);
    if (thisInt != otherInt) {
      return thisInt < otherInt ? -1 : 1;
    }
    thisPos++;
    otherPos++;
    compareRemaining--;
  }
  return remaining() - otherBuffer.remaining();
}

public int compareTo ( IntBuffer otherBuffer ) { int compareRemaining = ( remaining ( ) < otherBuffer . remaining ( ) ) ? remaining ( ) : otherBuffer . remaining ( ) ; int thisPos = position ; int otherPos = otherBuffer . position ; int thisInt , otherInt ; while ( compareRemaining > 0 ) { thisInt = get ( thisPos ) ; otherInt = otherBuffer . get ( otherPos ) ; if ( thisInt != otherInt ) { return thisInt < otherInt ? - 1 : 1 ; } thisPos ++ ; otherPos ++ ; compareRemaining -- ; } return remaining ( ) - otherBuffer . remaining ( ) ; }
compares the remaining ints of this buffer to another int buffer ' s remaining ints .
