```
public boolean isHappy2(int n) {
if(n == 1) return true;//1 is included in happy number loop
if(n == 4) return false;//4 is included in unhappy number loop
int sum = 0;
while(n > 0){
sum += (int) Math.pow(n%10, 2);
n /= 10;
}
return isHappy(sum);
}
```