```
public class Solution {
public boolean isUgly(int num) {
if(num<=0){
return false;
}
while((num&1)==0){
//number is divisible by 2
num = num/2;
}
while(num%5==0){
//number is divisible by 5
num = num/5;
}
while(num%3==0){
//number is divisible by 5
num = num/3;
}
return num==1;
}
}
```