Java Reference
In-Depth Information
long
. Sophisticated applications may require more functional-
ity (see "
Time, Dates, and Calendars
" on page
695
)
.
public static long
nanoTime()
Returns the current value, in nanoseconds, of the most pre-
cise available system timer. This method can only be used to
measure elapsed time and is not related to any notion of cal-
endar time or wall-clock time, and is not relative to the epoch.
Although the precision is in nanoseconds, there are no guar-
antees as to the accuracy.
public static void
arraycopy(Object src, int srcPos, Object dst, int
dstPos, int count)
Copies the contents of the source array, starting at
src[srcPos]
, to the destination array, starting at
dst[dstPos]
.
Exactly
count
elements will be copied. If an attempt is made
to access outside either array an
IndexOutOfBoundsException
is
thrown. If the values in the source array are not compatible
with the destination array an
ArrayStoreException
is thrown.
"Compatible" means that each object in the source array must
be assignable to the component type of the destination array.
For arrays of primitive types, the types must be the same,
not just assignable;
arraycopy
cannot be used to copy an array
of
short
to an array of
int
. The
arraycopy
method works cor-
rectly on overlapping arrays, so it can be used to copy one
part of an array over another part. You can, for example,
shift everything in an array one slot toward the beginning, as
public static int
identityHashCode(Object obj)
Returns a hashcode for
obj
using the algorithm that
Ob-
ject.hashCode
defines. This allows algorithms that rely on iden-
tity hashing to work even if the class of
obj
overrides
hashCode
.