Add a private static final MessageDigest DIGEST = MessageDigest.getInstance("MD5") and change this to

      // Compute the digest value
      int digest = DIGEST.digest(ptr.get(),ptr.getOffset(),ptr.getLength());
      // Allocate an byte array big enough to hold the digest value
      byte[] digestPtr = new byte[PDataType.INTEGER.getByteSize()];
      // Encode the digest value into the buffer (this saves boxing the digest into an Integer)
      PDataType.INTEGER.getCodec().encodeInt(digest, digestPtr, 0);
      // Set the results ptr to point to the digest value
      ptr.set(digestPtr);