This section describes some of the methods inSystemthat aren't covered in the previous sections.The
arrayCopymethod efficiently copies data between arrays. For more information, refer to Arrays in the Language Basics lesson.The
currentTimeMillisandnanoTimemethods are useful for measuring time intervals during execution of an application. To measure a time interval in milliseconds, invokecurrentTimeMillistwice, at the beginning and end of the interval, and subtract the first value returned from the second. Similarly, invokingnanoTimetwice measures an interval in nanoseconds.
NOTE: The accuracy of bothcurrentTimeMillisandnanoTimeis limited by the time services provided by the operating system. Do not assume thatcurrentTimeMillisis accurate to the nearest millisecond or thatnanoTimeis accurate to the nearest nanosecond. Also, neithercurrentTimeMillisnornanoTimeshould be used to determine the current time. Use a high-level method, such asjava.util.Calendar.getInstance.The
exitmethod causes the Java virtual machine to shut down, with an integer exit status specified by the argument. The exit status is available to the process that launched the application. By convention, an exit status of0indicates normal termination of the application, while any other value is an error code.