1// ! IMPORTANTE !
2// in JAVA an array is not the same as an ArrayList object!!
3// 1 - declare, instanciate and populate
4int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
5// 2 - declare and instanciate an int array with maxSize
6// note: the index goes between 0 and maxSize-1
7int newarr[] = new int[maxSize];
8// 2.1 - insert the value n on the position pos
9newarr[pos] = n;
10// 2.2 - insert values recursively
11for (i = 0; i < maxSize; i++) { newarr[i] = arr[i]; }