public int compareTo(DoubleBuffer otherBuffer){
  int compareRemaining=(remaining() < otherBuffer.remaining()) ? remaining() : otherBuffer.remaining();
  int thisPos=position;
  int otherPos=otherBuffer.position;
  double thisDouble, otherDouble;
  while (compareRemaining > 0) {
    thisDouble=get(thisPos);
    otherDouble=otherBuffer.get(otherPos);
    if ((thisDouble != otherDouble) && ((thisDouble == thisDouble) || (otherDouble == otherDouble))) {
      return thisDouble < otherDouble ? -1 : 1;
    }
    thisPos++;
    otherPos++;
    compareRemaining--;
  }
  return remaining() - otherBuffer.remaining();
}

public int compareTo ( DoubleBuffer otherBuffer ) { int compareRemaining = ( remaining ( ) < otherBuffer . remaining ( ) ) ? remaining ( ) : otherBuffer . remaining ( ) ; int thisPos = position ; int otherPos = otherBuffer . position ; double thisDouble , otherDouble ; while ( compareRemaining > 0 ) { thisDouble = get ( thisPos ) ; otherDouble = otherBuffer . get ( otherPos ) ; if ( ( thisDouble != otherDouble ) && ( ( thisDouble == thisDouble ) || ( otherDouble == otherDouble ) ) ) { return thisDouble < otherDouble ? - 1 : 1 ; } thisPos ++ ; otherPos ++ ; compareRemaining -- ; } return remaining ( ) - otherBuffer . remaining ( ) ; }
compare the remaining doubles of this buffer to another double buffer ' s remaining doubles .
