The Java official documentation states:
The string \"boo:and:foo\", for example, yields the following results with these expressions Regex Result :
\"boo:and:foo\"
test.split("\\|",999);
Specifing a limit or max will be accurate for examples like: "boo|||a" or "||boo|" or " |||"
But test.split("\\|"); will return different length strings arrays for the same examples.
test.split("\\|");
use reference: link