code: static int getAndCheckPreLongs(final Memory mem) {
      final long cap = mem.getCapacity();
      if (cap < 8) { throwNotBigEnough(cap, 8); }
      final int preLongs = mem.getByte(0) & 0x3F;
      final int required = Math.max(preLongs << 3, 8);
      if (cap < required) { throwNotBigEnough(cap, required); }
      return preLongs;
    }
docs: Checks Memory for capacity to hold the preamble and returns the extracted preLongs.
  @param mem the given Memory
  @return the extracted prelongs value.