```
public class Solution {
public boolean isHappy(int n) {
do{
n=squareSum(n);
}while(n>9);
if(n==1){
return true;
}
else{
return false;
}
}
public int squareSum(int n){
int sum=0;
while(n>0){
int l=n%10;
sum+=(l)*(l);
n=n/10;
}
return sum;
}
}
```