code: public static String encloseWithParentheses(List<String> vec) {
          if (vec.size() == 1) {
              return "[" + vec.get(0) + "]";
          } else if (vec.size() == 2) {
              return "[" + vec.get(0) + ", " + vec.get(1) + "]";
          } else {
              return "["
                      + encloseWithParentheses(vec.subList(0, (vec.size() / 2)))
                      + ", "
                      + encloseWithParentheses(vec.subList((vec.size() / 2), vec.size()))
                      + "]";
          }
      }
docs: This method will give the string "[[[a,b],[c,d]], ..., [z]]" instead of
  the List.toString() which will give "[a,b,c, ..., z]"
  
  [n1.0] becomes [n1.0]
  [n1.0, n2.0] becomes [n1.0, n2.0]
  [n1.0, n2.0, n3.0] becomes [[n1.0], [n2.0, n3.0]]
  [n1.0, n2.0, n3.0, n4.0] becomes [[n1.0, n2.0], [n3.0, n4.0]]
  [n1.0, n2.0, n3.0, n4.0, n5.0] becomes [[n1.0, n2.0], [[n3.0], [n4.0, n5.0]]]
  
  @param vec vector of propositional logic items (maximum five elements)
  @return the same formula of the input logic items with brackets
  @see TestEnclosingParentheses