For this Question: Given an array Arr, of N integers find the sum of max(A[i], A[j]) for all i, j such that i < j.The first line of the input contains an integer N, the size of the array.
The second line of the input contains N integers, the elements of the array Arr.

<b>Constraints:</b>
1 <= N <= 100000
1 <= Arr[i] <= 100000000Print a single integer which is the sum of min(A[i], A[j]) for all i, j such that i < j.Sample Input 1
4
5 3 3 1

Sample Output 1
24

Sample Input 2
2
1 10

Sample Output 2
10

<b>Explanation 1</b>
max(5,3) + max(5,3) + max(5,1) + max(3,3) + max(3,1) + max(3,1) = 24
, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {
       BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
	   int N = Integer.parseInt(read.readLine());
	   long[] arr = new long[N];

	   StringTokenizer st = new StringTokenizer(read.readLine());
	   for(int i=0; i<N; i++) {
		   arr[i] = Long.parseLong(st.nextToken());
	   }

	   Arrays.sort(arr);

	   long res = 0;
	   for(int i=N-1;i >-1; i--) {
		   res += arr[i]*i;
	   }







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