Check Two Words for Anagrams in Java

Write a program in Java to allow the user to input two words. Now check whether they are anagrams or not.

Two words are anagrams if the letters of one word can be rearranged to form the other word.

After checking, display a suitable message to the user.

Example 1:
INPUT:
First word: SILENT
Second word: LISTEN
OUTPUT:
SILENT and LISTEN are anagrams.

Example 2:
INPUT:
First word: SILENT
Second word: STENCIL
OUTPUT:
SILENT and STENCIL are NOT anagrams.

import java.io.*;
class Anagrams{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("First word: ");
        String first = br.readLine();
        System.out.print("Second word: ");
        String second = br.readLine();
        first = process(first);
        second = process(second);
        String s = sort(first);
        String t = sort(second);
        if(s.equals(t))
            System.out.println(first + " and " + second + " are anagrams.");
        else
            System.out.println(first + " and " + second + " are NOT anagrams.");
    }
    public static String process(String s){
        s = s.trim();
        if(s.indexOf(' ') > 0)
            s = s.substring(0, s.indexOf(' '));
        s = s.toUpperCase();
        return s;
    }
    public static String sort(String s){
        char a[] = new char[s.length()];
        for(int i = 0; i < s.length(); i++)
            a[i] = s.charAt(i);
        for(int i = 0; i < a.length; i++){
            for(int j = 0; j < a.length - 1 - i; j++){
                if(a[j] > a[j + 1]){
                    char temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }
        String result = "";
        for(int i = 0; i < a.length; i++)
            result += a[i];
        return result;
    }
}