regex regex java 10 цифр
String regex = "^\\d{10}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher("9876543210");
matcher.matches(); // returns true if pattern matches, else returns false
Tame Tortoise