The String class split() method returns you a String array. Suppose the array variable is str then you already have below values if you split using '|'.
You can store the combination as a combination int array ->
and print the str[combination]. Check with the array's length to avoid ArrayIndexOutOfBoundsException.
edit - by str[combination] I meant str[combination[0]], str[combination[1]],...