code: public static void alignDatanodes(DatanodeInfo[] dstLocs,
        DatanodeInfo[] srcLocs) {
      for (int i = 0; i < dstLocs.length; i++) {
        for (int j = 0; j < srcLocs.length; j++) {
          if (i == j)
            continue;
          if (dstLocs[i].equals(srcLocs[j])) {
            if (i < j) {
              swap(i, j, srcLocs);
            } else {
              swap(i, j, dstLocs);
            }
            break;
          }
        }
      }
    }
docs: Aligns the source and destination locations such that common locations
  appear at the same index.
  
  @param dstLocs
  the destination datanodes
  @param srcLocs
  the source datanodes