I was trying to make a code that will take input from a user and prints out the file path. I came across a interesting example. But I got stuck understanding a line.
//gets input from the user
BufferedReader input = new BufferedReader(newInputStreamReader(s.getInputStream()));
String request = input.readLine();
String path = new String();
int start = 0;
int end = 0;
for (int a = 0; a < request.length(); a++) {
if (request.charAt(a) == ' ' && start != 0) {
end = a;
break;
}
if (request.charAt(a) == ' ' && start == 0) {
start = a;
}
}
path = request.substring(start + 2, end);
Why is a 2 is added at the end?