Question about Microsoft Windows XP Professional With Servise Pack 2 (e8503040) for PC

1 Answer

To merge two arrays A and B in java source code.

A java program.pls help me out.

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.

  • Contributor
  • 2 Answers

Do you need them to be sorted after the merge and are they already sorted? If not, then what you can do is create a temporary third array which will set the half of third array equal to the first array, and then set the set half equal to the second array. If they need to be sorted, I can help too but you need to tell me

public class ArrayMerge
{
public static int arr1[] = new int [20];
public static int arr2[] = new int [20];

public static void main()
{
setScores(arr1);
setScores(arr2);
printScores(arr1);
printScores(arr2);
printScores(merger(arr1,arr2));
}

public static void setScores(int a[])
{
for(int x = 0; x<a.length; x++)
{
a[x]= (int)(Math.random() * 100)+1;
}
}

public static void printScores(int a[])
{
for(int x = 0; x<a.length; x++)
{
System.out.print(a[x] + " ");
}
System.out.println();
}

public static int[] merger(int a1[], int a2[])
{
int a3[] = new int [(a1.length + a2.length)];

for(int x = 0; x<a1.length; x++)
{
a3[x]=a1[x];
}

for(int x = 0; x<a2.length; x++)
{
a3[x+a2.length]=a2[x];
}
return a3;
}
}

Posted on Mar 07, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

I need source code for create login page plz send


Hi,

Can u mention pls... which language(PHP,JAVA... etc) source code is you want.

Thanks and Regards
Trinoj

Aug 05, 2011 | Operating Systems

1 Answer

I need a source code of a online examination in java


i believe you need an online test software java source code.
for this you should consult programming help sites. such as 1000projects.com , source code planet.com etc.

Nov 12, 2010 | Operating Systems

2 Answers

Merging two arrays and sort them


NEED A NEW KEY THE ONE ON THE BOX WONT WORK

Jul 29, 2009 | Microsoft Windows XP Professional With...

1 Answer

Can u give me example of source code of filing system in java?


Dear friend these websites are full of java source I hope they could help you:
www.java2s.com/
www.sun.com/software/opensource/java/
www.planet-source-code.com/
www.freejavaguide.com/javasource.htm

Good luck

Feb 22, 2009 | Operating Systems

3 Answers

What is servlets?


Java Servlet technology provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. A servlet can almost be thought of as an applet that runs on the server side--without a face. Java servlets make many Web applications possible.  » Read More The reference implementation is included in the Java EE 5 SDK and also in the open-source Java Platform, Enterprise Edition (Java EE) application server, available through the GlassFish project, which you can download from java.net. The reference implementation source code is available from the servlet-sources project on java.net.

Dec 29, 2008 | Microsoft Windows Vista Ultimate Edition

1 Answer

Help to developing java program code in a require format


Java is an "interpreted" language.
You need to use a "compiled" language, such as C++ or Fortran, in order to make an '.exe' file.

Find a "UNIX FOR DUMMIES" book -- it will describe "make" files.

Jul 28, 2008 | Operating Systems

1 Answer

I need a java code


I really needy of sourcecode of badmintone game in java
pls send it to my ID "firozdost@yahoo.com"

Mar 09, 2008 | Microsoft Windows XP Professional With...

Not finding what you are looking for?
Microsoft Windows XP Professional With Servise Pack 2 (e8503040) for PC Logo

Related Topics:

1,594 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Operating Systems Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Scott Fryer

Level 2 Expert

80 Answers

Alex Krenvalk

Level 2 Expert

401 Answers

Are you a Microsoft Operating System Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...