public int[] createArray(int size){return new int[size];}
Well it's a dumb code. Creates array of size you want. It's not expandable once created. For that you need to expand manually by copying to a larger array when your old array is full. Or better, get it done by a collection called ArrayList, which doubles capacity when reaches to some threshold.
If you implement your own expandable array, it will be same as using ArrayList: see
Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size. As elements are added to an ArrayList, its capacity grows automatically. The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost.