1. Learn
  2. /
  3. Courses
  4. /
  5. Optimizing Code in Java

Connected

Exercise

Measuring operation time

String concatenation is a common operation that can be a performance bottleneck when not implemented efficiently. In this exercise, you'll measure how long it takes to concatenate strings using the + operator.

Instructions

100 XP
  • Record the start time and the end time before and after our operation.
  • Calculate the total duration for our operation using startTime and endTime.