Original Post
Hey, I just started my gr 11 java course, and I need some help with something. And no moderators, im not asking for answers. I need to know how to sort number arrays. Im generating 200 numbers from 1-100 and they need to be sorted. I know you have to use 2 for Loops, im just not sure what to put in them. This is what I have so far; P.S- Look at the code with the ***, when I run it it prints the numbers, but says It has gone beyond boundaries or something like that, in essence, it doesnt work. // The "RandomStats" class. import java.awt.*; import hsa.Console; public class RandomStats { static Console c; // The output console public static void main (String [] args) { c = new Console (); int random [] = new int [200]; int first = 0; int second = 0; int third = 0; int fourth = 0; int fifth = 0; for (int n = 1 ; n <= 200 ; n++) { random [n] = (int) (Math.random () * 100) + 1;************ c.print (random [n] + " "); if (random [n] == 1 && random [n] <= 20) { first += 1; } else if (random [n] == 21 && random [n] <= 40) { second += 1; } else if (random [n] == 41 && random [n] <= 60) { third += 1; } else if (random [n] == 61 && random [n] <= 80) { fourth += 1; } else { fifth += 1; } } c.print (first); c.print (second); c.print (third); c.print (fourth); c.print (fifth); // Place your program here. 'c' is the output console } // main method