class Solution {

public boolean checkPerfectNumber(int num) {

if (num == 1) {

return false;

}

```
int result = 1;
int end = num;
for (int i = 2; i < end; i++) {
if (num % i == 0) {
result += i;
end = num / i;
result += end;
}
}
return result == num;
}
```

}