In Java there’s no built-in method.
You have two choices, follow:
- Write a method.
- Use third part library.
First choice, you can try to google.
Second choice, use Jakarta Commons Lang, it provides a host of helper utilities for the java.lang API, notably String manipulation methods, basic numerical methods, object reflection, creation and serialization, and System properties. etc. etc.