Question: I have the following array:

```
int nums[] = new int[]{1,2,3,4,5};

```

I want to add the same elements to the array using stream or another proper way if it is better using stream. There is `addAll()` method for `List`, but I could not use it for array and I am not sure if there is a proper way for array. So, how can I convert this list to:

```
int nums[] = new int[]{1,2,3,4,5,1,2,3,4,5};

```

Answer: 
how about using `Arrays.copyOf(arg, arg)`?

```
public static void main(String[] args) {
 int[] nums = new int[]{1, 2, 3, 4, 5, 1, 2, 3, 4, 5};
 int[] copiedArray = Arrays.copyOf(nums, nums.length);
}

```

If you really want to use Stream,

```
public static void main(String[] args) {
 int[] nums = new int[]{1, 2, 3, 4, 5, 1, 2, 3, 4, 5};
 int[] copiedArray = Arrays.stream(nums).toArray();
}

```
use Arrays.asList(your array) to convert your array to list

```
List<Integer> numList = Arrays.asList(nums);

```