For this Question: Given an integer N. The task is to find the square root of N. If N is not a perfect square, then return floor(√N). Try to solve the problem using Binary Search.The first line of input contains the number of test cases T. For each test case, the only line contains the number N.

<b>Constraints:</b>
1 &le; T &le; 10000
0 &le; x &le; 10<sup>8</sup>For each testcase, print square root of given integer.Sample Input:
2
5
4

Sample Output:
2
2

<b>Explanation:</b.
Testcase 1: Since, 5 is not a perfect square, the floor of square_root of 5 is 2.
Testcase 2: Since 4 is a perfect square, its square root is 2., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {

	static int binarySearch( int k,int start,int end) {
    	int mid = start + (end - start)/2;
		if (mid * mid == k) {

            return (int) mid;
        }
		else if ((mid*mid) > end) {
            return binarySearch( k, 0, mid - 1);
        }
		else if ((mid * mid < end)) {
            return binarySearch( k, mid + 1, end);
        }
		else {
            mid =  (int) Math.sqrt(k);
		}
        return mid;

	}

	public static void main (String[] args) throws IOException{
		InputStreamReader st = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(st);
        int T = Integer.parseInt(br.readLine());

        while (T-- > 0) {
            int n = Integer.parseInt(br.readLine());
			int k = n;
          	System.out.println(binarySearch( k, 0, n - 1));

        }
    }














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