Java tutorial
import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.Writer; import java.text.Collator; public class Main { public static void main(String args[]) throws Exception { String[] words = { "", "e", "a", "c" }; Writer w = new BufferedWriter(new OutputStreamWriter(System.out, "Cp850")); for (int i = 0; i < 4; i++) { w.write(words[i] + " "); } sortArray(Collator.getInstance(), words); for (int i = 0; i < 4; i++) { w.write(words[i] + " "); } w.flush(); w.close(); } public static void sortArray(Collator collator, String[] strArray) { String tmp; if (strArray.length == 1) return; for (int i = 0; i < strArray.length; i++) { for (int j = i + 1; j < strArray.length; j++) { if (collator.compare(strArray[i], strArray[j]) > 0) { tmp = strArray[i]; strArray[i] = strArray[j]; strArray[j] = tmp; } } } } }