Exercise: Array Statistics with Methods

Write a console program that uses methods to:

Your program output should look like this:

Array: 4, 8, 2, 1
Biggest number: 8
Product: 64
Amount of even numbers: 3
Reversed array: 1, 2, 8, 4
Write these methods to accomplish the tasks: Your main method can look like this:
int randNrsLength = 4;
int minIncl = 1;
int maxIncl = 8;

int[] randNrs = createRandomNumbers(randNrsLength, minIncl, maxIncl);

int biggestNr = getBiggestNumber(randNrs);
BigDecimal product = getProduct(randNrs);
int evenNrCount = countEvenNumbers(randNrs);
int[] reversed = reverseArray(randNrs);

System.out.println("Array: " + toString(randNrs));
System.out.println("Biggest number: " + biggestNr);
System.out.println("Product: " + product);
System.out.println("Amount of even numbers: " + evenNrCount);
System.out.println("Reversed array: " + toString(reversed));

Hand in instructions

  1. Make sure your program runs correctly.
  2. Follow Java naming conventions of variables.
  3. Make sure your program is well-formatted.
  4. Hand in your program by uploading Main.java to Moodle.