Java usando .indexof para alinear un espacio

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);
}
}
Lazy Lark