« on: 08:09:49, 14 Jan 2018 »
/**
* This program will sort the word "typewriter" in aphabetical order.
*/
public class SortingString {
public static void main(String[] args)
{
String s = "typewriter";
for (int i = 0; i < Integer.MAX_VALUE; i++)
{
s = randomSort(s);
if (s.equals("eeiprrttwy"))
{
System.out.println(s);
break;
}
if (i == Integer.MAX_VALUE - 1)
{
i = 0;
}
}
}
...
}
« Last Edit: 08:51:02, 14 Jan 2018 by gotty »
Logged