code: public InetAddress replicaNodeForId(final String id, int replicaNum) {
          if (replicaNum < 1 || replicaNum > 3) {
              throw new IllegalArgumentException("Replica number must be between 1 and 3.");
          }
  
          BucketConfig config = bucketConfig.get();
  
          if (config instanceof CouchbaseBucketConfig) {
              CouchbaseBucketConfig cbc = (CouchbaseBucketConfig) config;
              int partitionId = (int) hashId(id) & cbc.numberOfPartitions() - 1;
              int nodeId = cbc.nodeIndexForReplica(partitionId, replicaNum - 1, false);
              if (nodeId == -1) {
                  throw new IllegalStateException("No partition assigned to node for Document ID: " + id);
              }
              if (nodeId == -2) {
                  throw new IllegalStateException("Replica not configured for this bucket.");
              }
              try {
                  return InetAddress.getByName(cbc.nodeAtIndex(nodeId).hostname().address());
              } catch (UnknownHostException e) {
                  throw new IllegalStateException(e);
              }
          }  else {
              throw new UnsupportedOperationException("Bucket type not supported: " + config.getClass().getName());
          }
      }
docs: Returns the target replica node {@link InetAddress} for a given document ID and replica number on the bucket.
  
  @param id the document id to convert.
  @param replicaNum the replica number.
  @return the node for the given document id.