docs: public int readBit() throws IOException, JPEGMarkerException {
          int bit = 0;
  
          if (cnt == 0) {
              b = in.read();
              cnt = 8;
  
              if (b == 0xFF) {
                  // Loop here to discard any padding FF's on terminating marker
                  do {
                      b = in.read();
                  } while (b == 0xFF);
  
                  if (b == 0) {
                      /* Found FF/00, which represents an FF data byte */
                      b = 0xFF;
                      cnt = 8;
                  } else {
                      throw new JPEGMarkerException(b);
                  }
              } else if (b == -1) {
                  throw new JPEGMarkerException(b);
              }
          }
  
          bit = b >> 7;
          cnt--;
          b = b << 1;
  
          return bit & 0x1;
      }