Question: Code in java, Use Array and loops, not Arraylist. Problem. You are asked to implement a utility method which takes as input an array of

Code in java, Use Array and loops, not Arraylist. Problem. You areasked to implement a utility method which takes as input an arrayCode in java, Use Array and loops, not Arraylist.

Problem. You are asked to implement a utility method which takes as input an array of integers and returns another array grouping all elements from the input array as follows, from left to right: 1) elements divisible by 3; 2) elements divided by 3 with the remainder 1; and 3) elements divided by 3 with the remainder 2. For example, if the input array is: Then the output or returned array is: (6, 3, 4, 1 2, 5) Group 1 Group 2 Group 3 Note that the input and output arrays are equally long, meaning that if the input array is empty, then the output array should be empty. Also, each group of the output array should preserve the order in which its elements appear in the input array. For example, in the above example, Group 2 of the output array (i.e., those divided by 3 with the remainder 1) contains 4 followed by 1, reflecting their order in the input array. How many numbers do you want to input? 10 Enter input 1: 89 Enter input 2: 22 Enter input 3: 42 Enter input 4: 87 Enter input 5: 19 Enter input 6: 36 Enter input 7: 23 Enter input 8: 97 Enter input 9: 102 Enter input 10: 987

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!