Reference semantics questions
I would like you to comment these using the precondition/postcondition commenting style we have recently seen. What must be true in order for the method to run as promised? What will be true after the method has run?
Remember that method that modify arrays don’t need to return them, necessarily…
Double method
Write a static method doubleAll that takes an array of integers as a parameter and doubles each of its elements.
Reverse method
Write a static method reverse that takes an array as a parameter and reverses its content. Yes, we will have done this on the board, but it’s excellent practice to try your hand at again and get to run.
Swap method
Write a static method swap that takes an array of integers and two indexes as parameters. Your method should swap the elements at those two indexes.
evenBeforeOdd
int[] numbers = {5, 2, 4, 9, 3, 6, 2, 1, 11, 1, 10, 4, 7, 3};
{4, 2, 4, 10, 2, 6, 3, 1, 11, 1, 9, 5, 7, 3}




