How to compare anagrams without toCharArray method?
<pre><code>/*
 * 
 * 
 */

import java.util.Scanner;
import java.util.Arrays;


public class Anagram
{
  public static void main(String[] args)
  {

Scanner sc = new Scanner(System.in);
String one, two;

System.out.print("Enter first sentence: ");
String s1 = sc.nextLine();
System.out.print("Enter second sentence: ");
String s2 = sc.nextLine();

sc.close();

s1 = s1.toLowerCase();
char[] chars = s1.toCharArray();
Arrays.sort(chars);
String sort1 = new String(chars);
System.out.println(sort1 + " are the letters of " + s1 + " in order");

s2 = s2.toLowerCase();
char[] chars2 = s2.toCharArray();
Arrays.sort(chars2);
String sort2 = new String(chars2);
System.out.println(sort2 + " are the letters of " + s2 + " in order");

if(sort1.equals(sort2))
  System.out.println(s1 + " is an anagram of " + s2);


  }
}
</code></pre>

<p>This is my program that works fine using toCharArray to compare anagrams, however would it be possible to do it finiding every 'a' to 'z' and append it to the sorted list instead of toCharArray? </p>
