Question: Implement the method: public static int[] repeat(int[] array) that returns an array containing the original array elements repeated 3 times. For example, if you call

Implement the method: public static int[] repeat(int[] array) that returns an array containing the original array elements repeated 3 times. For example, if you call it with [1, 4, 9], then the method should return a new array containing [1, 4, 9, 1, 4, 9, 1, 4, 9]. Hints: 1. Create a new array of size determined by array.length 2. Use a for loop(s) to copy values from one array to the other in the required order.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!