I'm having trouble just calling up the methods from main. I just need to test them to see if they work.
public static void main(String[] args) { // TODO code application logic here } public static int randomInt(int low, int high) { int difference = high - low; return (int)(Math.random()*(difference + 1)) + low; } public static int[] randomIntArray (int n, int low, int high) { int[] a = new int[n]; for (int i = 0; i<a.length; i++) { a[i] = randomInt (low, high); } return a; } public static int indexOfMaxInRange(int[] arr, int lowIndex, int highIndex) { int indexOfMax = lowIndex; for (int i = lowIndex+1; i <= highIndex; i++) { if (arr[i] > arr[indexOfMax]) { indexOfMax = i; } } return indexOfMax; } public static void swapElement(int[] arr, int index1, int index2) { int temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; } public static void sort(int[] arr) { int length = arr.length; //use length-1 because do not need to swap last element with itself for (int i = 0; i < length-1; i++) { int indexOfMax = indexOfMaxInRange(arr, i, length-1); swapElement(arr, i, indexOfMax); } } }