Write a method called scaleByK that takes an ArrayList of integers as a parameter and replaces every

Question:

Write a method called scaleByK that takes an ArrayList of integers as a parameter and replaces every integer of value with copies of itself. For example, if the list stores the values [4, 1, 2, 0, 3] before the method is called, it should store the values [4, 4, 4, 4, 1, 2, 2, 3, 3, 3] after the method finishes executing. Zeroes and negative numbers should be removed from the list by this method.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: