Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this java program Write a method called fillArray that will take three parameters: an empty ArrayList of size n and an
I need help with this java program
Write a method called fillArray that will take three parameters: an empty ArrayList of size n and an int m, where m > n: this method will return an ArrayList with n int random entries moded by m. If the array already contains an entry, generate a new one to enter until there is no replication. Count how many times you have to generate a new entry as you fill the array of size n. import java.util.*: public class Exam2_42 { public static void main(String[] args){ ArrayList empty = new ArrayList (19): ArrayList nums = ___ (empty, 19, ___): } static ___ fillArray(ArrayList arr, int size, int num){ ___newEntry: int newEntryCounter = 0: Random rand = new ___ (): for(int i = 0: iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started