Largest Sum Contiguous Subarray - Kadene's algorithm I am looking forward to an answer to improve this code?
Thanks.
Test class
package test;

import main.algorithms.LargestSumContiguousSubarray;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class LargestSumContiguousSubarrayTest {

    LargestSumContiguousSubarray largestSumContiguousSubarray;

    @Before
    public void setUp(){
        largestSumContiguousSubarray = new LargestSumContiguousSubarray();
    }

    @Test
    public void testSumContiguousSubArray(){
        int[] a = {-2, -3, 4 - 1, -2, 1, 5, -3};
        int sum = 7;
        Assert.assertEquals(sum, largestSumContiguousSubarray.kadenesAlgo(a));
    }

}

LargestSumContiguousSubarray.java class
package main.algorithms;

public class LargestSumContiguousSubarray {

    // O(n)
    // Kadene's algorithm
    public int kadenesAlgo(int[] a) {

        // This is also works for negative numbers
        int max_so_far = a[0];
        int curr_max = a[0];

        for(int i=0;i&lt;a.length; i++){
            curr_max = Math.max(a[i], curr_max+a[i]);
            max_so_far = Math.max(max_so_far, curr_max);
        }
        return max_so_far;
    }
}
I have some suggestions for your code.
Replace the for loop with an enhanced 'for' loop
In your code, you don’t actually need the index provided by the loop, you can use the enhanced version.
before
for (int i = 0; i &lt; a.length; i++) {
//[...]
}

after
for (int current : a) {
//[...]
}

Variable and parameter name should be in camelCase style
The variables should be in camelCase.