```
/** Realization of a vector by means of an array.  The array has
* initial length 16 and is doubled when the size of the vector
* exceeds the capacity of the array.  No shrinking of the array is
* performed.
*/
public class ArrayVector implements Vector {
private Object[] A;		// array storing the elements of the vector
private int capacity = 16;	// initial length of array A
private int size = 0;		// number of elements stored in the vector
/** Creates the vector with initial capacity 16. */
public ArrayVector() {
A = new Object[capacity];
}
/** Inserts an element at the given rank. */
public void insertAtRank(int r, Object e)
throws BoundaryViolationException {
checkRank(r, size() + 1);
if (size == capacity) {		// an overflow
capacity *= 2;
Object[] B = new Object[capacity];
for (int i=0; i<size; i++)
B[i] = A[i];
A = B;
}
for (int i=size-1; i>=r; i--)	// shift elements up
A[i+1] = A[i];
A[r] = e;
size++;
}
/** Removes the element stored at the given rank. */
public Object removeAtRank(int r)
throws BoundaryViolationException {
checkRank(r, size());
Object temp = A[r];
for (int i=r; i<size-1; i++)	// shift elements down
A[i] = A[i+1];
size--;
return temp;
}
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.5663756,"math_prob":0.99173325,"size":1169,"snap":"2022-05-2022-21","text_gpt3_token_len":307,"char_repetition_ratio":0.14248927,"word_repetition_ratio":0.01980198,"special_character_ratio":0.32249787,"punctuation_ratio":0.14349777,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99681354,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-23T13:40:34Z\",\"WARC-Record-ID\":\"<urn:uuid:f78ad59b-f248-4555-a942-35fd358f5e28>\",\"Content-Length\":\"3462\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:40da4986-ad97-4f27-934d-469c50588bd7>\",\"WARC-Concurrent-To\":\"<urn:uuid:c758649d-91d6-43f0-88f7-24826ccae737>\",\"WARC-IP-Address\":\"128.148.32.12\",\"WARC-Target-URI\":\"http://cs.brown.edu/cgc/java3.datastructures.net/source/ch05/Java/ArrayVector-vector.html\",\"WARC-Payload-Digest\":\"sha1:S47EZ4LCZHAWVR2G2GV6TLD2I3WFKGQL\",\"WARC-Block-Digest\":\"sha1:V4UMKPWXHGPVWKWEC5SYSJXTTBH6D7PM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662558030.43_warc_CC-MAIN-20220523132100-20220523162100-00052.warc.gz\"}"}