You already return false if str.length() < 2 above.