Calculate the running median
The PriorityQueue was no good idea. What are you doing?

After the nth element, you copy all the previous n-1 elements into a temporary queue, which has complexity \$O(n)\$. Then you drain half the queue, which has complexity \$O(n \log n)\$. Summed up you get \$O(n^2 \log n)\$.

You're just misusing the queue as a sorting vehicle. That's not optimal as Arrays.sort has a faster algorithm (quicksort is faster, except when it goes wrong and this one tries pretty hard to avoid going wrong).

It would be probably faster to use an int[], track the size manually and re-sort the array after each element added. This has the same complexity, but could be faster as you at least avoid the copying.

Inserting the element in the proper position would lead to a total complexity of \$O(n^2)\$.

A much faster solution (I hope \$O(n \log n)\$) could be implemented using a TreeSet with higher and lower. There are also smart algorithms allowing to compute median without sorting the collection as you sort of need to sort only the middle part.

Review

public static float calculateMedian(PriorityQueue&lt;Integer&gt; pq) {


Don't use float unless you really have to conserve memory. They're pretty imprecise and they're no faster than double, at least on modern Desktop CPUs.

    int halfQueueSize = (temp.size() &gt;&gt; 1);

    if(temp.size() % 2 != 0) {


Do you optimize division by 2 as shift or don't you? Note that it hardly matters as this is surely not the most time-consuming operation here.

    if(temp.size() % 2 != 0) {
        while(index++ &lt;= halfQueueSize) {
            number = temp.poll();
        }
        return number;
    } else {
        while(index++ &lt; halfQueueSize) {
           number = temp.poll();
        }
        return ((number+temp.poll())/2.0f);
    }


You really shouldn't have two nearly identical branches. It makes it hard to spot the difference. With something like

    int halfQueueSize = (temp.size() &gt;&gt; 1) + (temp.size() &amp; 1);


you can use &lt; in both branches and pull the loop out.