Guest User

Untitled

a guest
Mar 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. static int[] isPowerOf2(int[] nums) {
  2. int[] poweroftwo = new int[nums.length];
  3. for(int i = 0; i<nums.length; i++){
  4. if(nums[i]!=0 && (nums[i]&(nums[i]-1)) == 0)
  5. poweroftwo[i]=1;
  6. else poweroftwo[i] = 0;
  7. }
  8. return poweroftwo;
  9. }
Add Comment
Please, Sign In to add comment