Skip to main content
3 of 11
added 59 characters in body
0x45
  • 798
  • 4
  • 17

Java, 408 Bytes

 public static int getPosSecondZero2(int number){ int overflow = 2^32-2; if(number < 0 || number > overflow){ return 0; } String binaryString = Integer.toBinaryString(number); char[] binaryCharArray = binaryString.toCharArray(); int count = 0; int idx = binaryCharArray.length; int length = binaryCharArray.length -1; while(count < 2 && idx>0){ idx--; if(binaryCharArray[idx] == '0'){ count++; } } if(count == 2) return length-idx; return 0; } 
0x45
  • 798
  • 4
  • 17