Write a method called doubleSize that accepts an integer array as a parameter and returns a reference to a new integer array that is twice as long and contains all of the elements of the first array in the same positions.

What will be an ideal response?


```
public int[] doubleSize(int[] originalArray) {
int[] newArray = int[originalArray.length*2];
for(int i = 0; i < originalArray.length; i++)
newArray[i] = originalArray[i];
return newArray;
}
```

Computer Science & Information Technology

You might also like to view...

Write code that declares x, y, and z as double variables. Then write code that causes z to be assigned the result of x divided by y, rounded as indicated below. Be sure to #include the header file that declares the library functions you use.

a) round up b) round down c) round to the nearest integer. Does your code round an exact half up or down? say 2.5?

Computer Science & Information Technology

____ is a way to copy or insert data from one application file into a different application file.

A. Resourcing B. Pasting C. Embedding D. Indexing

Computer Science & Information Technology

If the code in the Try section of a Try-Catch structure generates an error, the program will not be terminated when the exception occurs.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

____________________ is a high-level programming language developed for transaction processing applications.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology