private void enlargeCapacity(int key){
  int diff=offCount - offset;
  int minCapacity=Math.max(arr.length,key + offset + diff+ 1);
  if (minCapacity > arr.length) {
    int oldCapacity=arr.length;
    int newCapacity=oldCapacity + (oldCapacity >> 1);
    if (newCapacity - minCapacity < 0)     newCapacity=minCapacity;
    if (newCapacity - MAX_ARRAY_SIZE > 0)     newCapacity=hugeCapacity(minCapacity);
    arr=Arrays.copyOf(arr,newCapacity);
  }
}

private void enlargeCapacity ( int key ) { int diff = offCount - offset ; int minCapacity = Math . max ( arr . length , key + offset + diff + 1 ) ; if ( minCapacity > arr . length ) { int oldCapacity = arr . length ; int newCapacity = oldCapacity + ( oldCapacity > > 1 ) ; if ( newCapacity - minCapacity < 0 ) newCapacity = minCapacity ; if ( newCapacity - MAX_ARRAY_SIZE > 0 ) newCapacity = hugeCapacity ( minCapacity ) ; arr = Arrays . copyOf ( arr , newCapacity ) ; } }
! ! ! all methods that use this method must be sync enlarge the inner array to given size
