import java.util.regex.Pattern;
...
private static final Pattern SPACE = Pattern.compile(" ");
String[] arr = SPACE.split(str); // str is the string to be split
StringTokenizer tokens = new StringTokenizer("Hello I'm your String", " ");
String[] splited = new String[tokens.countTokens()];
int index = 0;
while(tokens.hasMoreTokens()){
splited[index] = tokens.nextToken();
++index;
}
String str = "Hello I'm your String";
String[] splited = str.split(" ");
var splited = str.split(" ");
var splited1=splited[0]; //Hello
var splited2=splited[1]; //I'm
var splited3=splited[2]; //your
var splited4=splited[3]; //String