In Java, you can measure the execution time of a method or code block using System.nanoTime() or System.currentTimeMillis().
1. Using System.nanoTime() (Recommended for Precision)
java https://docs.vultr.com/java/examples/calculate-the-execution-time-of-methods