For this Question: Arun has gone shopping for his new restaurant along with his 8-year-old daughter, Shruthi. They have bought N items. The items are numbered from 1 to N, and item i weighs W<sub>i</sub> grams. Shruthi is eager about helping carry the groceries for her father. She asks her father to give her some items to carry. Arun doesn't want to burden his daughter. But unless he offers her a few things to carry, she won't stop nagging him. Arun decides to give her a few things as a result. Arun obviously wants to give the child fewer things to carry. His daughter, though, is a smart kid. 


She advises that the goods be divided into two groups, one of which has exactly K things, in order to prevent being given the absolute least weight to carry. The larger group will then be carried by Arun and the lighter group by his daughter. Help Arun decide which items the daughter should carry. You'll have an easy job to do. Give Arun the maximum possible difference between the weight carried by him and the weight carried by his daughter.The first line of input contains an integer T, denoting the number of test cases. Then T test cases follow. The first line of each test contains two space-separated integers N and K. The next line contains N space- separated integers W<sub>1</sub>, W<sub>2</sub>,...., W<sub>N</sub>.

<b>Constraints</b>
1 &le; T &le; 100
1 &le; K &le; N &le; 100
1 &le; W<sub>i</sub> &le; 100,000 (10<sup>5</sup>)For each test case, output the maximum possible difference between the weights carried by both in grams.Sample Input :
2
5 2
8 4 5 2 10
8 3
1 1 1 1 1 1 1 1

Sample Output :
17
2
Explanation :
<ul><li>he optimal way is that Arun gives his daughter K = 2 items with weights 2 and 4. Arun carries the rest of the items himself. Thus the difference is (8+5+10)-(4+2) = 23-6 = 17. </li><li>Arun gives his daughter 3 items and he carries 5 items himself.</li></ul>, I have written this Solution Code: import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner in=new Scanner(System.in);
	int test=in.nextInt();
	while(test-->0)
	{
	    int n=in.nextInt();
	    int k=in.nextInt();
	    int arr[]=new int[n];
	    
	    for(int i=0; i<n; i++){
	        arr[i]=in.nextInt();
	    }
	    
	    Arrays.sort(arr);
	      if(k>n/2)
		    {
		        k=n-k;
		    }
	    
	    int sum=0;
	   for(int i=0; i<k; i++){
	       sum=sum+arr[i];
	   }
	  
	  int sum1=0;
	    for(int i=k; i<n; i++){
	        sum1=sum1+arr[i];
	    }
	    
	    if(sum>sum1){
	        int total=sum-sum1;
	        System.out.println(total);
	    }else{
	           int total=sum1-sum;
	    System.out.println(total);
	        
	    }
	  
	 
	}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?