public void readFields(DataInput in) throws IOException {
    try {
      p = in.readByte(); 
      k = in.readInt();
      s = in.readInt();
      if(k == 0) {
        s = 0;
      }
      // If p is negative, M does not exist
      if (p < 0) {
        p = (byte) -p;
        int m = (int)Math.pow(2, p);
        M = new byte[m];
      } else {
        int m = (int)Math.pow(2, p);
        M = new byte[m];
        for(int i = 0; i < m; i++) {
          M[i] = in.readByte();
        }
      }
      minhash = new long[s];

      for(int i = 0; i < s; i++) {
        long x = in.readLong();
        minhash[i] = x;
        /**
         * If p was negative, M is empty and we need to re-populate
         * If p was positive and we read M, this won't change anything since it's just max
         */
        int idx = (int)(x >>> (64 - p));
        long w = x << p;
        M[idx] =  (byte)Math.max(M[idx], Long.numberOfLeadingZeros(w) + 1);
      }
    } catch(Exception e) {
      throw new IOException(e);
    }
  }