title: Sorting a char array in java
body: <p>How would I sort a char array in Java? I know I can use java.util.Arrays.sort(), but if I manually want to sort it? Using bubble sort or something?</p>
  
  <p>Notice the string is "cab", the sorted result should be "abc". I don't know how to sort this, i know how to sort integers, but i don't know how to sort char arrays.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>String s1 = "cab";
  char[] arr;
  arr = s1.toCharArray();
  
  //Could use
  //java.util.Arrays.sort(arr);
  //But want to do it manually using something like bubble sort
  
  s1 = new String(arr);
  </code></pre>