if(input.charAt(i) == '0' || input.charAt(i) == '1' || input.charAt(i) == '2') {
}
Is there a way to condense this if condition, or no?
You could check if the character matches any index in a common String
. Like,
if ("012".indexOf(input.charAt(i)) > -1) {
}