public int solutionForBalancePoint(int[] A) {
        // write your code in Java SE 8
        long[] sumA = new long[A.length];
        long sum = 0;
        for (int i = 0; i < A.length; i++) {
            sumA[i] = (i == 0 ? 0 : sumA[i - 1]) + A[i];
        }

        for (int i = 0; i < A.length; i++) {
            long sumLeft = (i - 1 >= 0 ? sumA[i - 1] : 0);
            long sumRight = (i + 1 < A.length ? sumA[A.length - 1] - sumA[i] : 0);
            if (sumLeft == sumRight)
                return i;
        }
        return -1;
    }