Answer to Question #246591 in Java | JSP | JSF for sinchana

Question #246591
java program to check whether a number is prime or not using 'regex '
1
Expert's answer
2021-10-04T14:45:47-0400
public static boolean isPrime(int n) {
    return !new String(new char[n]).matches(".?|(..+?)\\1+");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS