how to separate java array based on string code example Example: split string into array java String[] array = values.split("\\|", -1);