com.google.zxing.common.BitArray#get ( )源码实例Demo

下面列出了com.google.zxing.common.BitArray#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ScreenCapture   文件: MatrixUtil.java
static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码2 项目: ScreenCapture   文件: CodaBarReader.java
/**
 * Records the size of all runs of white and black pixels, starting with white.
 * This is just like recordPattern, except it records all the counters, and
 * uses our builtin "counters" member for storage.
 * @param row row to count from
 */
private void setCounters(BitArray row) throws NotFoundException {
  counterLength = 0;
  // Start from the first white bit.
  int i = row.getNextUnset(0);
  int end = row.getSize();
  if (i >= end) {
    throw NotFoundException.getNotFoundInstance();
  }
  boolean isWhite = true;
  int count = 0;
  while (i < end) {
    if (row.get(i) != isWhite) {
      count++;
    } else {
      counterAppend(count);
      count = 1;
      isWhite = !isWhite;
    }
    i++;
  }
  counterAppend(count);
}
 
源代码3 项目: weex   文件: Encoder.java
static BitArray stuffBits(BitArray bits, int wordSize) {
  BitArray out = new BitArray();

  int n = bits.getSize();
  int mask = (1 << wordSize) - 2;
  for (int i = 0; i < n; i += wordSize) {
    int word = 0;
    for (int j = 0; j < wordSize; j++) {
      if (i + j >= n || bits.get(i + j)) {
        word |= 1 << (wordSize - 1 - j);
      }
    }
    if ((word & mask) == mask) {
      out.appendBits(word & mask, wordSize);
      i--;
    } else if ((word & mask) == 0) {
      out.appendBits(word | 1, wordSize);
      i--;
    } else {
      out.appendBits(word, wordSize);
    }
  }
  return out;
}
 
源代码4 项目: reacteu-app   文件: MatrixUtil.java
static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码5 项目: MiBandDecompiled   文件: d.java
static void b(int j, ByteMatrix bytematrix)
{
    if (j >= 7)
    {
        BitArray bitarray = new BitArray();
        a(j, bitarray);
        int k = 17;
        int l = 0;
        while (l < 6) 
        {
            int i1 = k;
            for (int j1 = 0; j1 < 3; j1++)
            {
                boolean flag = bitarray.get(i1);
                i1--;
                bytematrix.set(l, j1 + (-11 + bytematrix.getHeight()), flag);
                bytematrix.set(j1 + (-11 + bytematrix.getHeight()), l, flag);
            }

            l++;
            k = i1;
        }
    }
}
 
源代码6 项目: Telegram-FOSS   文件: MatrixUtil.java
static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
  if (version.getVersionNumber() < 7) {  // Version info is necessary if version >= 7.
    return;  // Don't need version info.
  }
  BitArray versionInfoBits = new BitArray();
  makeVersionInfoBits(version, versionInfoBits);

  int bitIndex = 6 * 3 - 1;  // It will decrease from 17 to 0.
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 3; ++j) {
      // Place bits in LSB (least significant bit) to MSB order.
      boolean bit = versionInfoBits.get(bitIndex);
      bitIndex--;
      // Left bottom corner.
      matrix.set(i, matrix.getHeight() - 11 + j, bit);
      // Right bottom corner.
      matrix.set(matrix.getHeight() - 11 + j, i, bit);
    }
  }
}
 
源代码7 项目: RipplePower   文件: Code93Reader.java
private int[] findAsteriskPattern(BitArray row) throws NotFoundException {
	int width = row.getSize();
	int rowOffset = row.getNextSet(0);

	Arrays.fill(counters, 0);
	int[] theCounters = counters;
	int patternStart = rowOffset;
	boolean isWhite = false;
	int patternLength = theCounters.length;

	int counterPosition = 0;
	for (int i = rowOffset; i < width; i++) {
		if (row.get(i) ^ isWhite) {
			theCounters[counterPosition]++;
		} else {
			if (counterPosition == patternLength - 1) {
				if (toPattern(theCounters) == ASTERISK_ENCODING) {
					return new int[] { patternStart, i };
				}
				patternStart += theCounters[0] + theCounters[1];
				System.arraycopy(theCounters, 2, theCounters, 0, patternLength - 2);
				theCounters[patternLength - 2] = 0;
				theCounters[patternLength - 1] = 0;
				counterPosition--;
			} else {
				counterPosition++;
			}
			theCounters[counterPosition] = 1;
			isWhite = !isWhite;
		}
	}
	throw NotFoundException.getNotFoundInstance();
}
 
源代码8 项目: weex   文件: UPCEANReader.java
/**
 * @param row row of black/white values to search
 * @param rowOffset position to start search
 * @param whiteFirst if true, indicates that the pattern specifies white/black/white/...
 * pixel counts, otherwise, it is interpreted as black/white/black/...
 * @param pattern pattern of counts of number of black and white pixels that are being
 * searched for as a pattern
 * @param counters array of counters, as long as pattern, to re-use
 * @return start/end horizontal offset of guard pattern, as an array of two ints
 * @throws NotFoundException if pattern is not found
 */
private static int[] findGuardPattern(BitArray row,
                                      int rowOffset,
                                      boolean whiteFirst,
                                      int[] pattern,
                                      int[] counters) throws NotFoundException {
  int patternLength = pattern.length;
  int width = row.getSize();
  boolean isWhite = whiteFirst;
  rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
  int counterPosition = 0;
  int patternStart = rowOffset;
  for (int x = rowOffset; x < width; x++) {
    if (row.get(x) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
          return new int[]{patternStart, x};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码9 项目: ScreenCapture   文件: ITFReader.java
/**
 * @param row       row of black/white values to search
 * @param rowOffset position to start search
 * @param pattern   pattern of counts of number of black and white pixels that are
 *                  being searched for as a pattern
 * @return start/end horizontal offset of guard pattern, as an array of two
 *         ints
 * @throws NotFoundException if pattern is not found
 */
private static int[] findGuardPattern(BitArray row,
                                      int rowOffset,
                                      int[] pattern) throws NotFoundException {
  int patternLength = pattern.length;
  int[] counters = new int[patternLength];
  int width = row.getSize();
  boolean isWhite = false;

  int counterPosition = 0;
  int patternStart = rowOffset;
  for (int x = rowOffset; x < width; x++) {
    if (row.get(x) != isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
          return new int[]{patternStart, x};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, counterPosition - 1);
        counters[counterPosition - 1] = 0;
        counters[counterPosition] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码10 项目: ZXing-Orient   文件: ITFReader.java
/**
 * @param row       row of black/white values to search
 * @param rowOffset position to start search
 * @param pattern   pattern of counts of number of black and white pixels that are
 *                  being searched for as a pattern
 * @return start/end horizontal offset of guard pattern, as an array of two
 *         ints
 * @throws NotFoundException if pattern is not found
 */
private static int[] findGuardPattern(BitArray row,
                                      int rowOffset,
                                      int[] pattern) throws NotFoundException {

  // TODO: This is very similar to implementation in UPCEANReader. Consider if they can be
  // merged to a single method.
  int patternLength = pattern.length;
  int[] counters = new int[patternLength];
  int width = row.getSize();
  boolean isWhite = false;

  int counterPosition = 0;
  int patternStart = rowOffset;
  for (int x = rowOffset; x < width; x++) {
    if (row.get(x) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
          return new int[]{patternStart, x};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
/**
 * @param row row of black/white values to search
 * @param rowOffset position to start search
 * @param whiteFirst if true, indicates that the pattern specifies white/black/white/...
 * pixel counts, otherwise, it is interpreted as black/white/black/...
 * @param pattern pattern of counts of number of black and white pixels that are being
 * searched for as a pattern
 * @param counters array of counters, as long as pattern, to re-use
 * @return start/end horizontal offset of guard pattern, as an array of two ints
 * @throws NotFoundException if pattern is not found
 */
private static int[] findGuardPattern(BitArray row,
                                      int rowOffset,
                                      boolean whiteFirst,
                                      int[] pattern,
                                      int[] counters) throws NotFoundException {
  int patternLength = pattern.length;
  int width = row.getSize();
  boolean isWhite = whiteFirst;
  rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
  int counterPosition = 0;
  int patternStart = rowOffset;
  for (int x = rowOffset; x < width; x++) {
    if (row.get(x) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        if (patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE) < MAX_AVG_VARIANCE) {
          return new int[]{patternStart, x};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码12 项目: weex   文件: Code93Reader.java
private int[] findAsteriskPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  Arrays.fill(counters, 0);
  int[] theCounters = counters;
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = theCounters.length;

  int counterPosition = 0;
  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) ^ isWhite) {
      theCounters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        if (toPattern(theCounters) == ASTERISK_ENCODING) {
          return new int[]{patternStart, i};
        }
        patternStart += theCounters[0] + theCounters[1];
        System.arraycopy(theCounters, 2, theCounters, 0, patternLength - 2);
        theCounters[patternLength - 2] = 0;
        theCounters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      theCounters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码13 项目: barcodescanner-lib-aar   文件: Code39Reader.java
private static int[] findAsteriskPattern(BitArray row, int[] counters) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (toNarrowWidePattern(counters) == ASTERISK_ENCODING &&
            row.isRange(Math.max(0, patternStart - ((i - patternStart) / 2)), patternStart, false)) {
          return new int[]{patternStart, i};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码14 项目: reacteu-app   文件: OneDReader.java
/**
 * Records the size of successive runs of white and black pixels in a row, starting at a given point.
 * The values are recorded in the given array, and the number of runs recorded is equal to the size
 * of the array. If the row starts on a white pixel at the given start point, then the first count
 * recorded is the run of white pixels starting from that point; likewise it is the count of a run
 * of black pixels if the row begin on a black pixels at that point.
 *
 * @param row row to count from
 * @param start offset into row to start at
 * @param counters array into which to record counts
 * @throws NotFoundException if counters cannot be filled entirely from row before running out
 *  of pixels
 */
protected static void recordPattern(BitArray row,
                                    int start,
                                    int[] counters) throws NotFoundException {
  int numCounters = counters.length;
  Arrays.fill(counters, 0, numCounters, 0);
  int end = row.getSize();
  if (start >= end) {
    throw NotFoundException.getNotFoundInstance();
  }
  boolean isWhite = !row.get(start);
  int counterPosition = 0;
  int i = start;
  while (i < end) {
    if (row.get(i) ^ isWhite) { // that is, exactly one is true
      counters[counterPosition]++;
    } else {
      counterPosition++;
      if (counterPosition == numCounters) {
        break;
      } else {
        counters[counterPosition] = 1;
        isWhite = !isWhite;
      }
    }
    i++;
  }
  // If we read fully the last section of pixels and filled up our counters -- or filled
  // the last counter but ran off the side of the image, OK. Otherwise, a problem.
  if (!(counterPosition == numCounters || (counterPosition == numCounters - 1 && i == end))) {
    throw NotFoundException.getNotFoundInstance();
  }
}
 
源代码15 项目: MiBandDecompiled   文件: Code93Reader.java
public Result decodeRow(int i, BitArray bitarray, Map map)
{
    int ai[] = a(bitarray);
    int j = bitarray.getNextSet(ai[1]);
    int k = bitarray.getSize();
    StringBuilder stringbuilder = new StringBuilder(20);
    int ai1[] = new int[6];
    do
    {
        recordPattern(bitarray, j, ai1);
        int l = a(ai1);
        if (l < 0)
        {
            throw NotFoundException.getNotFoundInstance();
        }
        char c1 = a(l);
        stringbuilder.append(c1);
        int i1 = ai1.length;
        int j1 = 0;
        int k1 = j;
        for (; j1 < i1; j1++)
        {
            k1 += ai1[j1];
        }

        int l1 = bitarray.getNextSet(k1);
        if (c1 == '*')
        {
            stringbuilder.deleteCharAt(-1 + stringbuilder.length());
            if (l1 == k || !bitarray.get(l1))
            {
                throw NotFoundException.getNotFoundInstance();
            }
            if (stringbuilder.length() < 2)
            {
                throw NotFoundException.getNotFoundInstance();
            } else
            {
                b(stringbuilder);
                stringbuilder.setLength(-2 + stringbuilder.length());
                String s = a(stringbuilder);
                float f = (float)(ai[1] + ai[0]) / 2.0F;
                float f1 = (float)(j + l1) / 2.0F;
                ResultPoint aresultpoint[] = new ResultPoint[2];
                aresultpoint[0] = new ResultPoint(f, i);
                aresultpoint[1] = new ResultPoint(f1, i);
                return new Result(s, null, aresultpoint, BarcodeFormat.CODE_93);
            }
        }
        j = l1;
    } while (true);
}
 
源代码16 项目: ScreenCapture   文件: Code128Reader.java
private static int[] findStartPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int[] counters = new int[6];
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) != isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        float bestVariance = MAX_AVG_VARIANCE;
        int bestMatch = -1;
        for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
          float variance = patternMatchVariance(counters, CODE_PATTERNS[startCode],
              MAX_INDIVIDUAL_VARIANCE);
          if (variance < bestVariance) {
            bestVariance = variance;
            bestMatch = startCode;
          }
        }
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (bestMatch >= 0 &&
            row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
          return new int[]{patternStart, i, bestMatch};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, counterPosition - 1);
        counters[counterPosition - 1] = 0;
        counters[counterPosition] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码17 项目: Tesseract-OCR-Scanner   文件: Code128Reader.java
private static int[] findStartPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int[] counters = new int[6];
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) != isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        float bestVariance = MAX_AVG_VARIANCE;
        int bestMatch = -1;
        for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
          float variance = patternMatchVariance(counters, CODE_PATTERNS[startCode],
              MAX_INDIVIDUAL_VARIANCE);
          if (variance < bestVariance) {
            bestVariance = variance;
            bestMatch = startCode;
          }
        }
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (bestMatch >= 0 &&
            row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
          return new int[]{patternStart, i, bestMatch};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, counterPosition - 1);
        counters[counterPosition - 1] = 0;
        counters[counterPosition] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码18 项目: barcodescanner-lib-aar   文件: Code128Reader.java
private static int[] findStartPattern(BitArray row) throws NotFoundException {
  int width = row.getSize();
  int rowOffset = row.getNextSet(0);

  int counterPosition = 0;
  int[] counters = new int[6];
  int patternStart = rowOffset;
  boolean isWhite = false;
  int patternLength = counters.length;

  for (int i = rowOffset; i < width; i++) {
    if (row.get(i) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == patternLength - 1) {
        float bestVariance = MAX_AVG_VARIANCE;
        int bestMatch = -1;
        for (int startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
          float variance = patternMatchVariance(counters, CODE_PATTERNS[startCode],
              MAX_INDIVIDUAL_VARIANCE);
          if (variance < bestVariance) {
            bestVariance = variance;
            bestMatch = startCode;
          }
        }
        // Look for whitespace before start pattern, >= 50% of width of start pattern
        if (bestMatch >= 0 &&
            row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {
          return new int[]{patternStart, i, bestMatch};
        }
        patternStart += counters[0] + counters[1];
        System.arraycopy(counters, 2, counters, 0, patternLength - 2);
        counters[patternLength - 2] = 0;
        counters[patternLength - 1] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();
}
 
源代码19 项目: weex   文件: RSSExpandedReader.java
private FinderPattern parseFoundFinderPattern(BitArray row, int rowNumber, boolean oddPattern) {
  // Actually we found elements 2-5.
  int firstCounter;
  int start;
  int end;

  if(oddPattern){
    // If pattern number is odd, we need to locate element 1 *before* the current block.

    int firstElementStart = this.startEnd[0] - 1;
    // Locate element 1
    while (firstElementStart >= 0 && !row.get(firstElementStart)) {
      firstElementStart--;
    }

    firstElementStart++;
    firstCounter = this.startEnd[0] - firstElementStart;
    start = firstElementStart;
    end = this.startEnd[1];

  }else{
    // If pattern number is even, the pattern is reversed, so we need to locate element 1 *after* the current block.

    start = this.startEnd[0];

    end = row.getNextUnset(this.startEnd[1] + 1);
    firstCounter = end - this.startEnd[1];
  }

  // Make 'counters' hold 1-4
  int [] counters = this.getDecodeFinderCounters();
  System.arraycopy(counters, 0, counters, 1, counters.length - 1);

  counters[0] = firstCounter;
  int value;
  try {
    value = parseFinderValue(counters, FINDER_PATTERNS);
  } catch (NotFoundException ignored) {
    return null;
  }
  return new FinderPattern(value, new int[] {start, end}, start, end, rowNumber);
}
 
private int[] findFinderPattern(BitArray row, int rowOffset, boolean rightFinderPattern)
    throws NotFoundException {

  int[] counters = getDecodeFinderCounters();
  counters[0] = 0;
  counters[1] = 0;
  counters[2] = 0;
  counters[3] = 0;

  int width = row.getSize();
  boolean isWhite = false;
  while (rowOffset < width) {
    isWhite = !row.get(rowOffset);
    if (rightFinderPattern == isWhite) {
      // Will encounter white first when searching for right finder pattern
      break;
    }
    rowOffset++;
  }

  int counterPosition = 0;
  int patternStart = rowOffset;
  for (int x = rowOffset; x < width; x++) {
    if (row.get(x) ^ isWhite) {
      counters[counterPosition]++;
    } else {
      if (counterPosition == 3) {
        if (isFinderPattern(counters)) {
          return new int[]{patternStart, x};
        }
        patternStart += counters[0] + counters[1];
        counters[0] = counters[2];
        counters[1] = counters[3];
        counters[2] = 0;
        counters[3] = 0;
        counterPosition--;
      } else {
        counterPosition++;
      }
      counters[counterPosition] = 1;
      isWhite = !isWhite;
    }
  }
  throw NotFoundException.getNotFoundInstance();

}