class Solution {

```
public boolean isHappy(int n) {
int sum = 0;
while(n>0)
{
int x = n%10;
sum = sum + (x*x);
n = n/10;
}
if(sum == 1)
{
return true;
}
else if(sum == 4)
{
return false;
}
return isHappy(sum);
}
```

}