I have an array in Java.
// original array
int[] arr = {1, 2, 3, 4};
How do I get another array that has the duplicated elements of the original array next to the original elements n number of times like so...
// n = 2
int[] arr2 = {1, 1, 2, 2, 3, 3, 4, 4};
// n = 3
int[] arr3 = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4};