code: public int getNextCode() {
          // Attempt to get the next code. The exception is caught to make
          // this robust to cases wherein the EndOfInformation code has been
          // omitted from a strip. Examples of such cases have been observed
          // in practice.
          try {
              nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
              nextBits += 8;
              
              if (nextBits < bitsToGet) {
                  nextData = (nextData << 8) | (data[bytePointer++] & 0xff);
                  nextBits += 8;
              }
              
              int code =
              (nextData >> (nextBits - bitsToGet)) & andTable[bitsToGet-9];
              nextBits -= bitsToGet;
              
              return code;
          } catch(ArrayIndexOutOfBoundsException e) {
              // Strip not terminated as expected: return EndOfInformation code.
              return 257;
          }
      }
docs: Returns the next 9, 10, 11 or 12 bits