Q:

How does "\\d" work in java?

example: if(str.matches(".*\\d.*"))
I used it recently to check if a value of an array contained a number.
What's the logic behind it? Why is the .* .* there? What does \\d mean?
EDIT: thank you all! such fast responses :)

A:

. symbol matches any character except newline. 
* repeats the character behind it 0 or more times. 
\d matches any digit. The extra \ in \\d is used to escape the backslash from the string.

So .\\d. matches any single character, a digit, and any single character. It will match the following: a1b, p3k, &2@
.*\\d.* matches 0 or more characters, a digit, and 0 or more characters. It will match the following: 2, 11, 123, asdf6klj
If you want to match 1 or more characters you can use +, {2,}, {3,5}, etc. 
+ means repeat previous character 1 or more times. 
{2, } means repeat previous character two or more times. 
{3, 5} means repeat previous character 3 to 5 times.
For more details you can review many regex tutorials such as here:
http://www.tutorialspoint.com/java/java_regular_expressions.htm

