@@ -0,0 +1,2347 @@
+//*****************************************************************************%0A//    Filename: RandomNumberList.java%0A//%0A//      Author: David C. Drake (http://davidcdrake.com)%0A//%0A// Description: Contains RandomNumberList, NumberList, and RandomNumber classes%0A//              for generating, printing, and recursively sorting linked lists%0A//              of random numbers.%0A//*****************************************************************************%0A%0Aimport java.util.*;%0A%0Apublic class RandomNumberList%0A%7B%0A  public static void main(String%5B%5D args)%0A  %7B%0A    final int LIST_SIZE = 50;%0A    NumberList numList = new NumberList();%0A%0A    for (int x = 0; x %3C LIST_SIZE; x++)%0A    %7B%0A      numList.insert(new RandomNumber());%0A    %7D%0A    for (int x = 0; x %3C LIST_SIZE; x++)%0A    %7B%0A      numList.sort(numList.list);%0A    %7D%0A    System.out.println(numList);%0A  %7D%0A%7D%0A%0Aclass NumberList%0A%7B%0A  public NumberNode list;%0A%0A  NumberList()%0A  %7B%0A    list = null;%0A  %7D%0A%0A  public void insert(RandomNumber newNumber)%0A  %7B%0A    NumberNode node = new NumberNode(newNumber);%0A    NumberNode current;%0A%0A    if (list == null)%0A    %7B%0A      list = node;%0A    %7D%0A    else%0A    %7B%0A      current = list;%0A      while (current.next != null)%0A      %7B%0A        current = current.next;%0A      %7D%0A      current.next = node;%0A    %7D%0A  %7D%0A%0A  public void sort(NumberNode currentNode) // Sorts in descending order.%0A  %7B%0A    int temp1, temp2;%0A    if (currentNode.next != null)%0A    %7B%0A      temp1 = currentNode.num.value;%0A      temp2 = currentNode.next.num.value;%0A      if (temp1 %3C temp2)%0A      %7B%0A        currentNode.num.value = temp2;%0A        currentNode.next.num.value = temp1;%0A      %7D%0A      sort(currentNode.next);%0A    %7D%0A  %7D%0A%0A  public String toString()%0A  %7B%0A    String result = %22%22;%0A    NumberNode current = list;%0A    while (current != null)%0A    %7B%0A      result += current.num.toString() + %22%5Cn%22;%0A      current = current.next;%0A    %7D%0A%0A    return result;%0A  %7D%0A%0A  private class NumberNode%0A  %7B%0A    public RandomNumber num;%0A    public NumberNode next;%0A%0A    public NumberNode(RandomNumber theNumber)%0A    %7B%0A      num = theNumber;%0A      next = null;%0A    %7D%0A  %7D%0A%7D%0A%0Aclass RandomNumber%0A%7B%0A  final int MAX_ABS_VALUE = 100;%0A  Random r = new Random();%0A  public int value;%0A%0A  public RandomNumber()%0A  %7B%0A    value = (int) ((Math.random() * (2 * MAX_ABS_VALUE)) - MAX_ABS_VALUE);%0A  %7D%0A%0A  public String toString()%0A  %7B%0A    return (%22%22 + value);%0A  %7D%0A%7D%0A

Add RandomNumberList.java