simple anagram problem solved in java