Hey guys looking for some help with my ArrayTester class...
The array is supposed to
1.create a 20 element int array and populates it with random elements in the range 20 through 65 (both inclusive).
-I Believe I have already done this.

2.Use the java.util.Random class with a seed of 2621 to generate repeatable output for the data.
-I have also already done this

3.The tester class should then test each of these methods(mean, median, mode, max, min, standard divination)
-this is where I'm having trouble, I already have the code for the mean, mode, max, min, and standard divination.. the problem I'm having is with the median as i would like to sort my array in the tester class before having it called by my main Class.

Is there any way to do this?

Here is my code:

public class ArrayTest
{

    public static void main(String [] args)
    {
        int[] numbers;
        numbers = new int [20];
        Random rand = new Random(2621); 
        int maxRange = 65;
        int minRange = 20;

        for(int i=0; i<20; i++)
        {
            numbers[i] = rand.nextInt(maxRange - minRange + 1) + minRange;
            //checks to see if printing out ocrrectly
            System.out.println(numbers[i]);

        }
    }
}

Recommended Answers

All 2 Replies

or if you have to write your own implementation, bubblesort is pretty easy to write.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.