code: protected DatanodeDescriptor[] findBest(List<DatanodeDescriptor> listOfNodes) {
  
      DatanodeDescriptor[] result = new DatanodeDescriptor[3];
  
      result[0] = listOfNodes.isEmpty() ? null : listOfNodes.get(0);
      result[1] = null;
      result[2] = null;
  
      for (DatanodeDescriptor n : listOfNodes) {
        findBestWithFirst(n, listOfNodes, result);
        if (result[2] != null)
          return result;
      }
  
      if (result[1] == null && listOfNodes.size() > 1) {
        findBestWithoutFirst(listOfNodes, result);
      }
  
      return result;
    }
docs: returns the best possible match of nodes to the first three replicas in
  in the current replication scheme
  result[0] = first replica or null
  result[1] = second replica or null
  result[2] = third replica or null