public int findIndex(int[] nums) {
        if (nums.length <= 1)
            return 0;
        int rightSum = 0;
        for (int i : nums) {
            rightSum += i;
        }
        int leftSum = 0;
        if (rightSum - nums[0] == 0)
            return 0;
        for (int i = 1; i < nums.length; ++i) {
            leftSum += nums[i - 1];
            rightSum -= nums[i];
            if (leftSum == rightSum)
                return i;
        }
        return 0;
    }