The Task it to check the input number is valid if it starts with only 7/8/9 and contains 10 digits. Here is the code. Correct me. I know I'm wrong.
public boolean validateMobileNumber(long number) throws Exception {
String num = Long.toString(number);
String regex = "@\"^[7-9]{10}$";
if (num.equals(regex))
return true;
else
throw new Exception("Invalid Number");
}