## How to count quicksort compares and swaps

Good evening all,
So i have created a quicksort on an array and it is working fine. I am trying to figure out where to place my counters to get a view of how this compares to the Big O Notation. I know Big O for quicksort is (n log n) so if I am doing the quicksort on 100 integers, I know the max should be about 660 give or take a few since n log n for 100 is 100 * 6.64385 = 664.3856
I have my Pivot in the middle for this as well.

When I am running this code, I am getting results of between 340 and 370 but I am only counting on the main while loop and not sure if I am counting in the correct spot. Any assistance or guidance would be appreciated. I can upload the entire code if necessary just put in the QuickSortRun class for brevity

Java Code:
```package myAlgorithmCounts;

import java.util.*;

public class QuickSortRun
{

private static int counterOne = 0;
private static int counterTwo = 0;
private static int counterThree = 0;
private static int counterFour = 0;
int[] list3;

public void QuickSortRun(int array[], int low, int n)
{
int lo = low;
int hi = n;
if (lo >= n)
{
return;
}

int mid = array[(lo + hi) / 2];
while (lo < hi)
{
while (lo < hi && array[lo] < mid)
{
lo++;
}
while (lo < hi && array[hi] > mid)
{
hi--;
}
if (lo < hi)
{
int T = array[lo];
array[lo] = array[hi];
array[hi] = T;
}
counterOne++;
}
if (hi < lo)
{
int T = hi;
hi = lo;
lo = T;
}
QuickSortRun(array, low, lo);
QuickSortRun(array, lo == low ? lo + 1 : lo, n);
list3 = Arrays.copyOf(array, n + 1);
}

public void displayList()
{
for (int i = 0; i < list3.length; i++)
{
System.out.print(" " + list3[i]);
}
System.out.println();
}

public int getCounterOne()
{
return counterOne;
}

public void setCounterOne(int counterOne)
{
QuickSortRun.counterOne = counterOne;
}

public int getCounterTwo()
{
return counterTwo;
}

public void setCounterTwo(int counterTwo)
{
QuickSortRun.counterTwo = counterTwo;
}

public int getCounterThree()
{
return counterThree;
}

public void setCounterThree(int counterThree)
{
QuickSortRun.counterThree = counterThree;
}

public int getCounterFour()
{
return counterFour;
}

public void setCounterFour(int counterFour)
{
QuickSortRun.counterFour = counterFour;
}
}```