public int maxChunksToSorted(int[] a) {
        if (a == null || a.length == 0)
            return 0;
        int counter = 0;
        for (int i = 0; i < a.length; i++) {
            int last = i;
            int max = a[i];
            int maxi = i;
            int current = a[i];
            for (int j = i + 1; j < a.length; j++) {
                if (current > a[j]) {
                    last = j;
                    if (maxi != i && maxi < last)
                        current = max;
                    continue;
                }

                if (max <= a[j]) {
                    max = a[j];
                    maxi = j;
                }
            }
            i = last;
            counter++;
        }

        return counter;
    }
Why Did you create this class? what does it do?
src/problems/hard/MaxChunksToMakeSorted2.java