What is the error in my code-------------
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int t = cin.nextInt();
while(t–>0){
int n = cin.nextInt(),arr[] = new int[n];
for(int i =0;i<arr.length;i++){
arr[i] = cin.nextInt();
}
System.out.println(maxSum[arr]);
}
}
public static int maxSum(int arr[]){
int maxTillHere = arr[0], maxInTotal[] = arr[0], minTillHere = arr[0], minInTotal = arr[0], sum = arr[0];
for(int i =1;i<arr.length;i++){
if(maxTillHere+arr[i]>arr[i]){
maxTillHere += arr[i];
}else{
maxTillHere = arr[i];
}
maxInTotal = Math.max(maxInTotal,maxTillHere);
if(minTillHere+a[i]<arr[i]){
minTillHere += arr[i];
}else{
minTillHere = arr[i];
}
minInTotal = Math.max(minInTotal,minTillHere);
sum += arr[i]
}
if(sum == maxInTotal)return maxInTotal;
return Math.max(sum - minInTotal, maxInTotal);
}
}