docs: public static int readPackedInt(InputStream is, int numBytes, boolean isLittleEndian)
        throws IOException {
      int value = 0;
      for (int i = 0; i < numBytes; i++) {
        int b = is.read();
        if (b == -1) {
          throw new IOException("no more bytes");
        }
        if (isLittleEndian) {
          value |= (b & 0xFF) << (i * 8);
        } else {
          value = (value << 8) | (b & 0xFF);
        }
      }
      return value;
    }