private void copyToOffset(int offset) {
    final int minCapacity = 2 * (offset + nbrruns);
    if (valueslength.capacity() < minCapacity) {
      // expensive case where we need to reallocate
      int newCapacity = valueslength.capacity();
      while (newCapacity < minCapacity) {
        newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE
            : newCapacity < 64 ? newCapacity * 2
                : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4;
      }
      ShortBuffer newvalueslength = ShortBuffer.allocate(newCapacity);
      copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns);
      this.valueslength = newvalueslength;
    } else {
      // efficient case where we just copy
      copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns);
    }
  }
private void copyToOffset ( int offset ) { final int minCapacity = 2 * ( offset + nbrruns ) ; if ( valueslength . capacity ( ) < minCapacity ) { int newCapacity = valueslength . capacity ( ) ; while ( newCapacity < minCapacity ) { newCapacity = ( newCapacity == 0 ) ? DEFAULT_INIT_SIZE : newCapacity < 64 ? newCapacity * 2 : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4 ; } ShortBuffer newvalueslength = ShortBuffer . allocate ( newCapacity ) ; copyValuesLength ( this . valueslength , 0 , newvalueslength , offset , nbrruns ) ; this . valueslength = newvalueslength ; } else { copyValuesLength ( this . valueslength , 0 , this . valueslength , offset , nbrruns ) ; } }
Push all values length to the end of the array (resize array if needed)