check if a number is present in a string java code example Example: check if string contains numbers str.matches(".*\\d.*");