Check out example codes for "java using .indexof to fin a space". It will help you in understanding the concepts better.

Code Example 1

class Sample{
public static void main(String[] args) {
    String s = "1110 001";
    int index = -1;
    for(int i = 0; i < s.length(); i++ ){
        if(Character.isWhitespace(s.charAt(i))){
            index = i;
            break;
        }
    }

    System.out.println("Required Index : " + index);
}
}

Learn ReactJs, React Native from akashmittal.com