0

I'm converting a string into a character array in order to use the Arrays.sort() method on it. However, when I turn the array back into a string and try to print it out, it gives me a bunch of hexadecimal (I believe) instead of the actual string. In fact, I also get hexadecimal trying to print the sortedStringchar... why is this happening, why am I not getting the strings/character array printed in characters?

    String originalString = "HELLO";
    char[] sortedStringChar = originalString.toCharArray();
    Arrays.sort(sortedStringChar);
    String sortedString = sortedStringChar.toString();
    System.out.println("Sorted String ===== " + sortedString);

Output of System.out.println:

      Sorted String ===== [C@2d928643
CISSflow
  • 89
  • 5

0 Answers0