Help with sorting numbers

My goal is to generate 10,000 random numbers and sort them in arrays. I have the random numbers made easy enough and I have a small quick sort class but I am having trouble combining the two.

This is the random number generator

Code :

import java.util.*;
public class NumberGenerator {
public static void main(String args[]){
Random Generator = new Random();
int[] myArray = new int[10000];
for(int idx = 0;idx <=10000; ++idx){
int nums = Generator.nextInt(10000);
myArray[idx] = nums;
}

This is the quick sort

Code :

public class QuickSort {
int partition(int array[], int left, int right)
{
int i = left, j = right;
int tmp;
int pivot = array[(left + right) / 2];
while (i <= j) {
while (array[i] < pivot)
i++;
while (array[j] > pivot)
j--;
if (i <= j) {
tmp = array[i];
array[i] = array[j];
array[j] = tmp;
i++;
j--;
}
};
return i;
}
void quickSort(int array[], int left, int right) {
int index = partition(array, left, right);
if (left < index - 1)
quickSort(array, left, index - 1);
if (index < right)
quickSort(array, index, right);
}
}

Thanks for your help

Re: Help with sorting numbers

Is this for class and you have to make your own sort?

If not, you can simply say:

and your array will be sorted.

Re: Help with sorting numbers

Quote:

having trouble combining the two

Are you asking how to call a method in one class from a method in another class?

One way is shown in post#2. Define the method to be called as static.

The other way is to create an instance of the object and use that to call the method.