For this Question: Given an input stream of N integers. The task is to insert these numbers into a new stream and find the median of the stream formed by each insertion of X to the new stream.

<b>Note:</b> Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values.<b>User Task:</b>
Since this will be a functional problem, you don't have to take input. You just have to complete the function 
 <b>getMedian() </b> that takes X as parameter.

Constraints:
1 <= N <= 10^5
1 <= X <= 10^5You need to return the median.Sample Input:
4
5
15
1 
3

Sample Output:
5.0
10.0
5.0
4.0
 
Explanation:
Testcase 1:
Flow in stream : 5, 15, 1, 3
5 goes to stream --> median 5.0 (5)
15 goes to stream --> median 10.0 (5, 15)
1 goes to stream --> median 5.0 (5, 15, 1)
3 goes to stream --> median 4.0 (5, 15, 1, 3), I have written this Solution Code: static PriorityQueue<Integer> smaller = new PriorityQueue<>(Collections.reverseOrder()); //Max heap for lower values
    static PriorityQueue<Integer> greater = new PriorityQueue<>(); // Min heap for greater values
    static double med = 0.0;
    public static double getMedian(int x)
    {

        if(smaller.size()==0)
        {
            med=x;
            smaller.add(x);
            return x;

        }



        // case1(left side heap has more elements)
        if(smaller.size() > greater.size())
        {
            if(x < med)
            {
                greater.add(smaller.remove());
                smaller.add(x);
            }
            else
                greater.add(x);
            med = (double)(smaller.peek() + greater.peek())/2;
        }

        // case2(both heaps are balanced)
        else if(smaller.size() == greater.size())
        {
            if(x < med)
            {
                smaller.add(x);
                med = (double)smaller.peek();
            }
            else
            {
                greater.add(x);
                med = (double)greater.peek();
            }
        }

        // case3(right side heap has more elements)
        else
        {
            if(x > med)
            {
                smaller.add(greater.remove());
                greater.add(x);
            }
            else
                smaller.add(x);
            med = (double)(smaller.peek() + greater.peek())/2;

        }
        return med;

    }, In this Programming Language: Java, Now tell me if this Code is compilable or not?