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) {
      counters[counterPosition]++;
    }
 else {
      counterPosition++;
      if (counterPosition == numCounters) {
        break;
      }
 else {
        counters[counterPosition]=1;
        isWhite=!isWhite;
      }
    }
    i++;
  }
  if (!(counterPosition == numCounters || (counterPosition == numCounters - 1 && i == end))) {
    throw NotFoundException.getNotFoundInstance();
  }
}

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 ) { counters [ counterPosition ] ++ ; } else { counterPosition ++ ; if ( counterPosition == numCounters ) { break ; } else { counters [ counterPosition ] = 1 ; isWhite = ! isWhite ; } } i ++ ; } if ( ! ( counterPosition == numCounters || ( counterPosition == numCounters - 1 && i == end ) ) ) { throw NotFoundException . getNotFoundInstance ( ) ; } }
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 .
