code: public static int getNumberOfPages(RandomAccessFileOrArray ra) {
  		try {
  			JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
  			sr.read();
  			return sr.numberOfPages();
  		} catch (Exception e) {
  	        throw new ExceptionConverter(e);
  	    }
      }
docs: *
  Gets the number of pages in a JBIG2 image.
  @param ra	a random acces file array containing a JBIG2 image
  @return	the number of pages