public boolean numCheck(String input, int number) { if(number > input.length()) { // handle the case where the input String length is shorter than the number param return false; } // have to subtract one off the number as charAt is indexed starting at 0 if(Character.isDigit(input.charAt(number - 1)) { return true; } return false; }