This seems like homework (or an interview question?). If that's the case and you are required to use arrays rather than the built in methods with the Java Collection Objects, (or even if not, really), the answer is the Fisher-Yates Shuffle algorithm
The modern in-place shuffle is:
To shuffle an array a of n elements (indexes 0..n-1):
for i from n − 1 downto 1 do
j ← random integer with 0 ≤ j ≤ i
exchange a[j] and a[i]
(I'd have to check, but I suspect this is what Java uses under the hood for its shuffle() methods).
Edit because it's fun to implement algorithms:
In java, this would be:
public static void main(String[] args) {
int[] a = new int[15];
for (int i = 1; i <= 15; i++)
{
a[i-1] = i;
}
Random rg = new Random();
int tmp;
for (int i = 14; i > 0; i--)
{
int r = rg.nextInt(i+1);
tmp = a[r];
a[r] = a[i];
a[i] = tmp;
}
for (int i = 0; i < 15; i++)
System.out.print(a[i] + " ");
System.out.println();
}
And ... this can be further optimized using the inside-out version of the algo since you're wanting to insert a known series of numbers in random order. The following is the best way to achieve what you stated as wanting to do as there are no extra copies being made such as when creating an ArrayList and having it copy back out to an array.
a = new int[15];
Random rg = new Random();
for (int i = 0; i < 15; i++)
{
int r = rg.nextInt(i+1);
a[i] = a[r];
a[r] = i+1;
}