Power Of Two Code using java

  1. boolean isPowerOfTwo(int n)
  2. {  int i=1;
  3.   while(i<n)
  4.   {
  5.      i*=2;
  6.    }
  7.    return i==n;
  8. }

Comments

Popular posts from this blog

BYTE STUFFING PROGRAM USING C

Rotate a matrix 270 degree AntiClockWise

Finding the length of connected cells of 1's (regions) in an matrix of 1's and 0's