Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
copying slices of arrays
Pho Tek
Ranch Hand
Posts: 782
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have two byte arrays.
byte[] source = new byte[20]; byte[] target = new byte[20]; // some inits of the 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:
for (int i=0; i<8; i++){ target[i] = source[i]; }
Thanks
G
Regards,
Pho
David O'Meara
Rancher
Posts: 13459
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Don't know if it's exactly what you want, but have you seen
java.lang.System.arrayCopy()
?
Dave
(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
Posts: 782
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes that's what I need. Thanks David.
Pho
Regards,
Pho
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Creating an IndexColorModel with 8 Colours
byte array of byte arrays.
How to create png image with the pixels array?
Int array to 3D array
Standard DES?
More...