public static int partition(int[] records, int low, int high){
        if(low > records.length - 1|| high > records.length - 1) {
            throw new IllegalArgumentException();
        }
        int pivot = records[low];
        while(low < high){
            while (records[high] > pivot  && low < high){
                high--;
            }
            swap(records, low, high);
            while (records[low] < pivot  && low < high){
                low++;
            }
            swap(records, low, high);
        }
        return low;

    }