VOOZH about

URL: https://www.geeksforgeeks.org/java/java-guava-shorts-join-method-with-examples/

⇱ Java Guava | Shorts.join() method with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Java Guava | Shorts.join() method with Examples

Last Updated : 11 Jul, 2025
Shorts.join() is a method of Shorts class in Guava library which returns a combined string of all the given short values separated by separator. For example, join("-", (short) 1, (short) 2, (short) 3) returns the string "1-2-3". Syntax :
public static String join(String separator,
 short... array)
Parameters :
  • separator : The text that should appear between consecutive values in the resulting string (but not at the start or end).
  • array : An array of short values, possibly empty.
Return Value: A string containing the supplied short values separated by separator. Example-1:
Output:
2#4#6#8#10
Example-2:
Comment