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...

Which of the following is in order processing for a binary tree?

a. i) process the right subtree ii) process the root node data iii) process the left subtree b. i) process the left subtree ii) process the root node data iii) process the right subtree c. i) process the root node data ii) process the left subtree iii) process the right subtree d. i) process the left subtree ii) process the right subtree iii) process the root node e. i) process the right subtree ii) process the left subtree iii) process the root node

Computer Science & Information Technology

The Rename command is used to change the name to better match its contents.

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

Computer Science & Information Technology

When you open a database, Access assumes that the database might contain something that could damage your computer.

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

Computer Science & Information Technology

Read?mostly memory

What is the meaning of the term (when applied to memory systems technology)?

Computer Science & Information Technology