Untitled
unknown
plain_text
10 months ago
324 B
3
Indexable
public class TwoPowers {
static boolean isPower(int x){
if(x == 1){
return true;
}
if(x%2 != 0){
return false;
}
return isPower(x/2);
}
public static void main(String[] args) {
System.out.println(isPower(2048));
}
}
Editor is loading...
Leave a Comment