comefrom: <gouthampradhan>bit_manipulation_BinaryNumberWithAlternatingBits_1.java
code: public boolean hasAlternatingBits(int n) {
      int curr = n & 1;
      int pos = 0;
      for (int i = 0; i < 32; i++) {
        if ((n & (1 << i)) > 0) {
          pos = i;
        }
      }
      for (int i = 1; i <= pos; i++) {
        int temp = (1 << i) & n;
        if ((temp > 0 && curr > 0) || (temp == 0 && curr == 0)) return false;
        curr = temp;
      }
      return true;
    }
masked: public boolean var_0 ( int var_1 ) {
    int var_2 = var_1 & 1 ;
    int var_3 = 0 ;
    for ( int var_4 = 0 ;
    var_4 < 32 ;
    var_4 ++ ) {
      if ( ( var_1 & ( 1 << var_4 ) ) > 0 ) {
        var_3 = var_4 ;
      }
    }
    for ( int var_4 = 1 ;
    var_4 <= var_3 ;
    var_4 ++ ) {
      int var_5 = ( 1 << var_4 ) & var_1 ;
      if ( ( var_5 > 0 && var_2 > 0 ) || ( var_5 == 0 && var_2 == 0 ) ) return false ;
      var_2 = var_5 ;
    }
    return true ;
  }
  