I'm trying to make a project that asks for the number of strings a person wants, then prompts the person to enter the strings in any order. Then I am supposed to order them alphabetically and I CAN NOT use Java.util at all. I am supposed to use any type of sorting algorithm that can sort the inputted strings in alphabetical order. This is my code so far, could any one help me put a sorting algorithm in my code?
package sorting;
import java.io.*;
public class Sorting
{
private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
public static void main(String[] arguments) throws IOException
{
System.out.println("How many strings would you like to enter?");
int stringCount = Integer.parseInt(stdin.readLine());
String[] stringInput = new String[stringCount];
String message = "";
for(int i = 0; i < stringCount; i++)
{
System.out.print("Could you enter the strings here: \n");
stringInput[i] = stdin.readLine();
message = message + stringInput[i] + ", ";
}
System.out.println("So you entered:\n" + message);
}
private static void bubbleSort(String[] stringInput, int length) {
int temp, counter, index;
for(counter=0; counter<length-1; counter++) {
for(index=0; index<length-1-counter; index++) {
if(stringInput[index] > stringInput[index+1]) {
temp = stringInput[index];
stringInput[index] = stringInput[index+1];
stringInput[index+1] = temp;
}
}
}
}
}