code: private VarTensor[] getMsgs(int f, VarTensor[] msgs, boolean isIn) {
          int numNbs = bg.numNbsT2(f);
          VarTensor[] arr = new VarTensor[numNbs];
          for (int nb=0; nb<numNbs; nb++) {
              int edge = isIn ? bg.opposingT2(f, nb) : bg.edgeT2(f, nb);
              arr[nb] = msgs[edge];
          }
          return arr;
      }
docs: Gets messages from the Messages[].
  
  @param f The factor's index.
  @param msgs The input messages.
  @param isNew Whether to get messages in .newMessage or .message.
  @param isIn Whether to get incoming or outgoing messages.
  @return The output messages.