title: Runtime error in Cyclic Binary String Question
body: <p>Today I am solving hackerrank problem and unfortunately, I am stuck on this. Actually, I passed 4 test cases but the rest test case shows runtime error.. <hr /></p>
  <p><strong>Here is my code -</strong></p>
  <pre><code>public static String leftrotate(String str, int d) {
          String ans = str.substring(d) + str.substring(0, d);
          return ans;
  }
  
  public static String rightrotate(String str, int d) {
      return leftrotate(str, str.length() - d);
  }
  
  public static int maximumPower(String s) {
      int size = s.length();
      int arr[] = new int[size];
      for(int i = 0; i &lt; size; i++){
          arr[i] = Integer.parseInt(rightrotate(s, i), 2);
      }
      int max = 0;
      for(int i = 0; i &lt; size; i++){
          for(int j = 1; j &lt; size; j++){
              if(arr[i] % Math.pow(2, j) == 0){
                  //System.out.println(arr[i] + &quot;power = &quot; +Math.pow(2, j));
                  if(max &lt; j){
                      max = j;
                  }
              }
          }
      }
      
      return max;
  }
  </code></pre>