For this Question: There is an integer array nums having n integers, given as input. Find the sum of all subarrays of given array nums and Return it.There is an integer n (size of array nums) given as input.
In the Second line, n space-separated integers are given as input.

<b>Constraints</b>
1 &le; n &le; 10<sup>5</sup>
0 &le; nums[i] &le; 5*10<sup>4</sup>
0 &le; i &le; n-1Return the sum of all the subarrays of given array nums.Sample Input:
3
1 2 3 
Sample Output:
20

Explanation :
{1} + {2} + {3} + {2 + 3} + {1 + 2} + {1 + 2 + 3} = 20, I have written this Solution Code: import java.io.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class Main{
    

    public static void main(String []args){
        Scanner sc = new Scanner(System.in);
        long ans=0;
		int n=sc.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++){
			arr[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			ans+=(long)(i+1)*(n-i)*arr[i];
		}
		System.out.println(ans);
		return;
    }


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