Try triming the string before splitting. Trmming will remove all the leading and trailing whitespaces.
String tmp = "Hello I am fine ";
String str[] = tmp.trim().split(" ");
System.out.println("STR[0] => " + str[0]);
String tmp1 = " Hello I am fine ";
String str1[] = tmp1.trim().split(" ");
System.out.println("STR1[0] => " + str1[0]);