Previous solutions are all using HashMap or Array to record message,which is unnecessary.With few variables and three operation( * and + and XOR),we can easily solve the problem.Here is my code.

To avoid Integer Overflow,I make some reduction.

```
public class Solution {
public boolean isAnagram(String s, String t) {
if(s.length() != t.length())
return false;
char[] sArray = s.toCharArray();
char[] tArray = t.toCharArray();
int sSum = 0;
int tSum = 0;
long sMul = 1;
long tMul = 1;
int sXOR = 0;
int tXOR = 0;
for(int i = 0;i<s.length();i++){
sSum += sArray[i];
sMul *= sArray[i]-'a'+1;
sXOR ^= sArray[i];
tSum += tArray[i];
tMul *= tArray[i]-'a'+1;
tXOR ^= tArray[i];
}
return (sSum == tSum) && (sMul == tMul) &&(sXOR == tXOR);
}
}
```

Perhaps it's not straight-forward,let me make some explaination.

Assume we have two Strings："ab" and "cd"

Firstly I figure out:

```
sSum = a+b,tSum = c+d
sMul = a*b,tMul = c*d
```

if sSum equals tSum ,and sMul equals tMul,we get the equations:

```
a+b = c+d
a*b = c*d
```

After simplification we get the equation

```
a*a + b*b = c*c +d*d
```

We can prove that once the equation is satisfied,a is either c or d,and b is either d or c.

Great appreciation for @ManuelP 's counter-examples