code: static boolean isIndexPage(@NonNull ByteArraySegment pageContents) {
          // Check ID match.
          int headerId = BitConverter.readInt(pageContents, ID_OFFSET);
          int footerId = BitConverter.readInt(pageContents, pageContents.getLength() - FOOTER_LENGTH);
          if (headerId != footerId) {
              throw new IllegalDataFormatException("Invalid Page Format (id mismatch). HeaderId=%s, FooterId=%s.", headerId, footerId);
          }
  
          int flags = pageContents.get(FLAGS_OFFSET);
          return (flags & FLAG_INDEX_PAGE) == FLAG_INDEX_PAGE;
      }
docs: Determines whether the given ByteArraySegment represents an Index Page
  
  @param pageContents The ByteArraySegment to check.
  @return True if Index Page, False if Leaf page.
  @throws IllegalDataFormatException If the given contents is not a valid BTreePage format.