For this Question: You have an array sorted in non- decreasing order and an element key. You have to find whether the key is present inside your array or not.The first line contains a single element N(size of our array)
The next line contains N space- separated integer A[i].
The next line contains a single integer key.Determine whether the key is present in our array or not.Sample Input 1:
8
5 6 7 8 1 2 3 4
7

Sample Output 1:
1

Explanation:
7 present at 3rd index., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) {

                      Scanner sc = new Scanner(System.in);
                      int n = sc.nextInt();
                      int[] arr = new int[n];

                      for(int i =0; i < n; i++){
                          arr[i] = sc.nextInt();
                      }
                        int k = sc.nextInt();
                        boolean ans = false;
                      for(int i =0; i < n; i++){
                          if(arr[i] == k){
                              ans = true;
                          }
                      }
                      if(ans){
                          System.out.print(1);
                      }else{
                          System.out.print(0);
                      }

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