Sort Characters of String - Alphabetically

HOw to sort the Characters of a String Alphabetical order.

looking for the algorithm

if the String is "SAMPLE" (String s = "SAMPLE")

need to get the answer as "AELMPS"

Message was edited by:

jugp

[233 byte] By [jugpa] at [2007-11-27 11:33:07]
# 1

try converting the string to an array of the letters, sort the array, and then convert the sorted array back into a string. you should be able to figure out the rest. Look at the API for String for the methods you need.

~Tim

SomeoneElsea at 2007-7-29 16:49:28 > top of Java-index,Java Essentials,Java Programming...
# 2

How would you do it without a computer?

CeciNEstPasUnProgrammeura at 2007-7-29 16:49:28 > top of Java-index,Java Essentials,Java Programming...