@@ -0,0 +1,635 @@
+%0Apublic class test %7B%0A%0A%09/**%0A%09 * Main method%0A%09 * @param args%0A%09 */%0A%09public static void main(String%5B%5D args) %7B%0A%09%09int%5B%5D array = new int%5B%5D%7B-1,2,3,-4,5,6,7,-3,-1%7D;%0A%09%09System.out.println(maxSub(array));%0A%09%7D%0A%09%0A%09/**%0A%09 * Kadane's algorithm for solving%0A%09 * the maximum subarray problem%0A%09 * @param array of integers%0A%09 * @return value of maximum subarray%0A%09 */%0A%09public static int maxSub(int%5B%5D array) %7B%0A%09%09int maxSoFar = 0;%0A%09%09int maxEndingHere = 0;%0A%09%09int temp;%0A%09%09%0A%09%09for(int i: array)%7B%0A%09%09%09temp = i + maxEndingHere;%0A%09%09%09maxEndingHere = (temp %3E 0)? temp : 0;%0A%09%09%09maxSoFar = (maxEndingHere %3E maxSoFar)? maxEndingHere : maxSoFar;%0A%09%09%7D%0A%09%09%0A%09%09return maxSoFar;%0A%09%7D%0A%0A%7D%0A

Create kadaneAlgo.java