Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

sorting the characters of a string in java

import java.util.Arrays;

public class Test
{
    public static void main(String[] args)
    {
        String original = "edcba";
        char[] chars = original.toCharArray();
        Arrays.sort(chars);
        String sorted = new String(chars);
        System.out.println(sorted);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sorting #characters #string #java
ADD COMMENT
Topic
Name
4+2 =