attemptedCombo.substring(attemptedCombo.length()) returns the whole string, not the last digit. for that you want attemptedCombo.substring(attemptedComob.length()-1,attemptedCombo.length())

But...