Question: Using and defining static methods for arrays Create a program in a class named ArrayOfIntegers that: Defines a static method random that receives a size,

Using and defining static methods for arrays

Create a program in a class named ArrayOfIntegers that:

Defines a static method "random" that receives a size, a minimum value and a maximum value and generates randomly an array with that size and with values between the minimum and maximum values

Defines a static method "print" that receives an array of integers and print the array in the format [1, 4, 3, 7]

Defines a static method "max" that receives an array of integers and return the maximum value or null if none

Defines a static method "indexOfMax" that receives an array of integers and return the index of the maximum value or -1 if none

Defines a static method "count" that counts how many times a given value appears in a given array.

A main method that computes and prints in the console the following:

Generates an array of 20 elements between -10 and 10, and print it

The maximum value

The first index of the maximum value

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!