double [] data;The class should have a constructor that allocates the array and initializes it with data.
public SelectionSort()Use random values in the interval [0.0, 1000.0]. For how to create random values in Java search for, say, "Java random". You will find information about class Random. The class can generate random values in the interval[0.0, 1.0]. You will need to multiply the numbers appropriately to get values in [0.0, 1000.0]. Obviously, the value 1000.0 should be declared as final static in your class. The size of the array should also be declared as a constant.
It would be nice to add some prints in the constructor that inform the user that the array is being initialized, with what type of values, and what is its size. This is true in general, and its good to get used to making your code print its progress. It will help you tons in debugging.
To sort the data, you will write a method:
public void sort()This method will implement selection sort. You can write the entire code for selection inside this function; however, I suggest that you write a helper function that will select the smallest element, and use it inside sort. I also suggest that you write a function that swaps two values in the array.
//finds the smallest element in the range from start to end and //returns its position int selectMin(int start, int end) //swaps data[i] with data[j] void swap(int i, int j)Finally, to test your sort you will write a method that checks that data is sorted:
//returns true if data is sorted in <= order public bool isSorted()
For example, you may want to add a print method that prints the values in data[]. What I see people doing over and over again is that they write a loop to print the array every time they need it. Gee, this is so ugly and inconvenient. Just write a singel print method, and call it every time you want to see the array.
The most common method for debugging involves the use of print statements. The other thing you could do is learn how to use the BlueJ Debugger. You can find links on the class website. If you learn to use the Debugger effectively (and it isn't difficult) it will save you many hours of work during the semester.
Good luck!