code: private static String _join(String[] tokens, boolean excludeLast)
      {
          StringBuilder join = new StringBuilder();
          int length = tokens.length - (excludeLast ? 1 : 0);
          for (int i = 0; i < length; i++)
          {
              join.append(tokens[i]).append("/");
          }
  
          return join.toString();
      }
docs: Join tokens, exlude last if param equals true.
  
  @param tokens
  the tokens
  @param excludeLast
  do we exclude last token
  @return joined tokens