.
Unfortunately those answers are only right for the example and the actual answer can be in the range [2,147,483,648..2,147,483,647]. But if that try catch loop works you may have a way to hack through many of the questions.
You need to find the array index where the sum of all the elements before it matches the sum of all the elements after it.
If A[0] + A[1] + A[2] = A[4] + A[5] +A[6] the answer is 3