public static int findFirst(int value, int idx) {
    value &= ~((1 << idx) - 1); // Mask off too-low bits.
    int result = Integer.numberOfTrailingZeros(value);
    return (result == 32) ? -1 : result;
  }
Finds the lowest-order bit set at or after the given index in the given {@code int}.

@param value the value in question
@param idx 0..31 the minimum bit index to return
@return {@code >= -1;} lowest-order bit set at or after {@code idx}, or {@code -1} if there is
    no appropriate bit index to return
android/android_framework/dex-maker/src/main/java/com/android/dx/util/Bits.java