If I have an array A and I wanted to copy it into a larger array, how would I do that with the arraycopy(...) method?
thanks
5 9533
If I have an array A and I wanted to copy it into a larger array, how would I do that with the arraycopy(...) method?
thanks
And what do the docs say about System.arraycopy?
I wouldn't be posting here if I hadn't already looked at it. I don't understand how the parameters work for it. for ex:
system.arraycopy(the source array, the index you want to start copying from, the destination array, ?, ?)
along with those 2 question marks, where do you make the destination array?
I wouldn't be posting here if I hadn't already looked at it. I don't understand how the parameters work for it. for ex: system.arraycopy(the source array, the index you want to start copying from, the destination array, ?, ?) along with those 2 question marks, where do you make the destination array?
Which docs did you check?
Quote = docs
arraycopy (Object src, int srcPos, Object dest, int destPos, int length)
Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
/**
*
*/
import java.lang.System;
/**
* @author 72hosh1mst
*
*/
public class arrayofcopy {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
char [] a1={'a','b','c','d','e','f'};
char [] b1={'x','y','z','u','v'};
System.arraycopy(a1,1,b1,2,3);
System.out.println(b1);
}
}
JosAH 11,448
Recognized Expert MVP
I wouldn't be posting here if I hadn't already looked at it. I don't understand how the parameters work for it. for ex:
system.arraycopy(the source array, the index you want to start copying from, the destination array, ?, ?)
along with those 2 question marks, where do you make the destination array?
What's the problem then? That method copies data from one array (the source)
to another array (the destination). The method wants to know the start offset
in both arrays as well as the number of elements to copy and there it goes.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Terrence |
last post by:
I am doing some of the C# walkthroughs to transition from
VB to C#. When I try to execute
static void Main()
{
Aplication.Run(new Form1())
}
I raise a 'System.NullReferenceException" in...
|
by: laks |
last post by:
Hi
I have the following xsl stmt.
<xsl:for-each select="JOB_POSTINGS/JOB_POSTING
\">
<xsl:sort select="JOB_TITLE" order="ascending"/>
This works fine when I use it.
But when using multiple...
|
by: NicK chlam via DotNetMonster.com |
last post by:
this is the error i get
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
at System.Data.Common.DbDataAdapter.Update(DataRow dataRows,
DataTableMapping tableMapping)
at...
|
by: Sky |
last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but
be Type, AssemblyName. Fair enough, get the reason. (Finally!).
As long as it doesn't cause tech support problems...
|
by: forest demon |
last post by:
for example, let's say I do something like,
System.Diagnostics.Process.Start("notepad.exe","sample.txt");
if the user does a SaveAs (in notepad), how can i capture the path that
the user...
|
by: mfunkmann |
last post by:
Hi,
I recently got an error and I don't know how to fix it:
Error 1 'System.Data.DataColumn' does not contain a definition for
'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO
I...
|
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= |
last post by:
Hi,
I am wondering why the .NET Framework is quite different from Win32 API when
it comes to displaying system modal message boxes.
Consider the four following types of system modal message...
|
by: Mike |
last post by:
Hi
I have problem as folow:
Caught Exception: System.Configuration.ConfigurationErrorsException:
An error occurred loading a configuration file: Request for the
permission of type...
|
by: Jordan |
last post by:
I could seem to find a built in function that would serve the purpose
of System.arraycopy() in java.
I was able to accomplish it with something like this:
def arraycopy(source, sourcepos,...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |