Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes copying slices of arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "copying slices of arrays" Watch "copying slices of arrays" New topic

copying slices of arrays

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 782

I have two byte arrays.

I would like to copy the 1st 8 bytes from source to target.
Is there any util class that does that automatically - rather
than me doing:



David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Don't know if it's exactly what you want, but have you seen java.lang.System.arrayCopy()?
(oh well, I tried. UBB doesn't like links to methods in the Java API)
[This message has been edited by David O'Meara (edited December 11, 2001).]
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 782

Yes that's what I need. Thanks David.
I agree. Here's the link:
subject: copying slices of arrays
It's not a secret anymore!