public int median_queue(int[] nums) {
        int n = nums.length;
        int k = n / 2;
        if (n % 2 == 1)
            k += 1;
        Compare c = new Compare();
        PriorityQueue<Integer> queue = new PriorityQueue<>(c);
        for (int i : nums) {
            queue.offer(i);
            if (queue.size() > k) {
                queue.poll();
            }
        }
        return queue.peek();
    }