It is still showing an error

import java.util.*;

import java.util.Scanner;

public class Main {

public static void main(String args[]) {

Scanner sc=new Scanner(System.in);

	int t=sc.nextInt();
	while(t>0) {
	int n=sc.nextInt();
	long[] nums=new long[(int)n];
	for(int i=0;i<n;i++) {
		nums[i]=sc.nextInt();
	}
	long max=Integer.MIN_VALUE;
	long sum = 0;
	for(int i=0;i<nums.length;i++) {
		sum=sum+nums[i];
		if(max<sum) {
			max=sum;
		}
		if(sum<0) {
			sum=0;
		}
	}
	System.out.println(sum);
	t--;
	}
}

}

@laibaahsan27_1dfa992390072fd9 you have used Integer.MIN_VALUE; change this to Long.MIN_VALUE;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

import java.util.*; import java.util.Scanner; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t>0){ int n=sc.nextInt(); long[] nums=new long[(int)n]; for(int i=0;i<n;i++) { nums[i]=sc.nextInt(); } long max=Long.MIN_VALUE; long sum = 0; for(int i=0;i<nums.length;i++) { sum=sum+nums[i]; if(max<sum) { max=sum; } if(sum<0) { sum=0; } } System.out.println(sum); t–; } } }

it is still not accepting my my code could you please tell a proper solution in a single message

@laibaahsan27_1dfa992390072fd9

class Kadane { 

   static int maxSubArraySum(int a[], int size) 
   { 
       int max_so_far = Integer.MIN_VALUE, 
       max_ending_here = 0,start = 0, 
       end = 0, s = 0; 

       for (int i = 0; i < size; i++)  
       { 
           max_ending_here += a[i]; 

           if (max_so_far < max_ending_here)  
           { 
               max_so_far = max_ending_here; 
               start = s; 
               end = i; 
           } 

           if (max_ending_here < 0)  
           { 
               max_ending_here = 0; 
               s = i + 1; 
           } 
       } 
       return s;
   } 

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.