@Test public void testGetSetBitOffsetWithNothingSet1() { int v = Creator.getSetBitOffset(0, 0); assertEquals(-1, v); }
protected static int getSetBitOffset(final int mask, final int bitIndex) { int count = 0; int workingMask = mask; int low = Integer.numberOfTrailingZeros(workingMask); workingMask >>>= low; assert (workingMask & 1) == 1 || workingMask == 0; for (int i = low; workingMask != 0; i++) { if ((workingMask & 1) != 0) { if (count == bitIndex) { return i; } count++; } workingMask >>>= 1; } return -1; }
Creator { protected static int getSetBitOffset(final int mask, final int bitIndex) { int count = 0; int workingMask = mask; int low = Integer.numberOfTrailingZeros(workingMask); workingMask >>>= low; assert (workingMask & 1) == 1 || workingMask == 0; for (int i = low; workingMask != 0; i++) { if ((workingMask & 1) != 0) { if (count == bitIndex) { return i; } count++; } workingMask >>>= 1; } return -1; } }
Creator { protected static int getSetBitOffset(final int mask, final int bitIndex) { int count = 0; int workingMask = mask; int low = Integer.numberOfTrailingZeros(workingMask); workingMask >>>= low; assert (workingMask & 1) == 1 || workingMask == 0; for (int i = low; workingMask != 0; i++) { if ((workingMask & 1) != 0) { if (count == bitIndex) { return i; } count++; } workingMask >>>= 1; } return -1; } private  Creator(); }
Creator { protected static int getSetBitOffset(final int mask, final int bitIndex) { int count = 0; int workingMask = mask; int low = Integer.numberOfTrailingZeros(workingMask); workingMask >>>= low; assert (workingMask & 1) == 1 || workingMask == 0; for (int i = low; workingMask != 0; i++) { if ((workingMask & 1) != 0) { if (count == bitIndex) { return i; } count++; } workingMask >>>= 1; } return -1; } private  Creator(); static GameMatrix createFull(); static GameMatrix createVariant(
            final GameMatrix fullyFilled); static Riddle createRiddle(final GameMatrix fullMatrix); }
Creator { protected static int getSetBitOffset(final int mask, final int bitIndex) { int count = 0; int workingMask = mask; int low = Integer.numberOfTrailingZeros(workingMask); workingMask >>>= low; assert (workingMask & 1) == 1 || workingMask == 0; for (int i = low; workingMask != 0; i++) { if ((workingMask & 1) != 0) { if (count == bitIndex) { return i; } count++; } workingMask >>>= 1; } return -1; } private  Creator(); static GameMatrix createFull(); static GameMatrix createVariant(
            final GameMatrix fullyFilled); static Riddle createRiddle(final GameMatrix fullMatrix);  }