For this Question: You are given an array of integers arr of size n, a window of size k. Your task is to find the sum of the maximum element from each window.The first line contains the input of n, k ie the size of the array, and the size of the window.
The next line contains the input of the array.

<b>Constraints</b>
1 <= k < n <= 10<sup>5</sup>
1 <= arr[i] <= 10<sup>5</sup>Print the single line containing the maximum sum.Sample Input 1:
5 3
1 2 3 4 5

Sample Output 1:
12

Sample Input 2:
6 2
2 3 1 7 8 3

Sample Output 2:
29, I have written this Solution Code: import java.io.*;
import java.util.*;
class Main {
    public static void main(String[] args) throws IOException{
  	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
               String srr[] = br.readLine().trim().split(" ");
            int n = Integer.parseInt(srr[0]);
            int k = Integer.parseInt(srr[1]);
             String ksrr[] = br.readLine().trim().split(" ");
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] =Integer.parseInt(ksrr[i]);
            }

                      long sum=0,ans=0;
                       for(int i=0;i<=n-k;i++){
                          int maxval=0;
                          for(int j=i;j<i+k;j++){
                              if(j>=n) break;
                              maxval=Math.max(maxval,arr[j]);
                          }
                           ans+=maxval;
                       }
                       System.out.println(ans);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?