private static int nextMask(boolean value,
                              int prevMask) {
    return nextMask(value ? 1 : 0, 1, prevMask);
  }
private static int nextMask(boolean value,
                              int prevMask)