public interface TestingFunctions
Modifier and Type | Method and Description |
---|---|
int |
greatestCommonDivisor(int a,
int b)
This method calculates and returns the GCD of a and b using a binary calculation
method based on the pseudo code retrieved from Wikipedia on 4/5/18
(original pseudo code show below method)
|
void |
reverseWindow(int[] arr,
int index1,
int index2)
This method reverses the subsection of the passed array defined by index1
and index2.
|
int greatestCommonDivisor(int a, int b)
a
- - the first integer, must be positiveb
- - the second integer, must be positivevoid reverseWindow(int[] arr, int index1, int index2) throws java.lang.IndexOutOfBoundsException
arr
- - the array to reverseindex1
- - the first index of the subsectionindex2
- - the non-inclusive upper bound of the subsection,
last element swapped will be at the index (index2 - 1)java.lang.IndexOutOfBoundsException
- if index1 or (index2) are not valid indexes of arr