I'm just learning java and this is my first sort program. I can't get it to run. I sure could use some help.
public class SortCharArray
{
public static void main(String[] args) throws Exception
{
char[] someChars = new char[10];
int x;
for(x = 0; x < someChars.length; ++x)
{
System.out.print("Enter a character ");
someChars[x] = (char)System.in.read();
System.in.read(); System.in.read();
}
System.out.println("Before sort");
for(x = 0; x < someChars.length; ++x)
System.out.print(someChars[x] + " ");
bubbleSort(someChars, someChars.length);
System.out.println("\nAfter sort");
for(x = 0; x < someChars.length; ++x)
System.out.print(someChars[x] + " ");
System.out.println();
}
public static void bubbleSort(char[] array, int len)
{
int a, b;
char temp;
int highSubscript = len - 1;
for(a = 0; a < highSubscript; ++a)
{
for(b = 0; b < highSubscript; ++b)
if(array[b] > array[b = 1])
{
temp = array[b];
array[b] = array[b + 1];
array[b + 1] = temp;
}
}
}
}