For this Question: Given an array A of size n, and an integer k. Find the maximum force by involving only k elements. Force of an element is the square of its value.

<b>Note:</b> Elements are not needed to be continuous.The first line of the input contains two integers denoting n and k.
Next line contains n integers denoting elements of the array.

Constraints:
1 < = k < = n < = 1000
-10^7 <= A[i] <= 10^7

Functional problem, so implement the predefined functionOutput the maximum force.Sample Input:
4 4
1 2 3 4

Output:
30

Explanation:
Force = 1*1 + 2*2 + 3*3 + 4*4 = 30

Sample Input:
2 1
1 10

Sample Output:
100, 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 k = sc.nextInt();
                      long arr[] = new long[n];
                      long x = 0;
                      for(int i=0 ; i<n ; i++){
                      x = sc.nextLong();
                      arr[i] = x*x;
                      x=0;
                      }

                      Arrays.sort(arr);

                      long sum = 0;
                      long count = n - k;

                      for(int i=n-1; i>=count ; i--){
                          sum = sum + arr[i];
                      }

                      System.out.println(sum);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?