Java Solution Optimized Simple Approach Beat 85% ✅💯
Intuition1. Initialization:
ans: A variable of type long is used to store the result, which is the sum of concatenated values.
si: A pointer to the start of the
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
**1. Initialization:**
- ans: A variable of type long is used to store the result, which is the sum of concatenated values.
- si: A pointer to the start of the array (initialized to 0).
- ei: A pointer to the end of the array (initialized to nums.length - 1).

**2. While Loop:**
- The while loop runs as long as si <= ei:
    - Concatenation & Summation:
        - If si is not equal to ei, the elements at si and ei are concatenated as strings. The string concatenation is achieved by converting each element to a string using Integer.toString(nums[si]) and Integer.toString(nums[ei]), and then adding them together. The resulting string is then parsed back to an integer, which is added to the result (ans).
        - If si equals ei, it means we are at the middle element (in case of an odd-length array). In this case, we simply add the value of nums[ei] to ans (as no concatenation happens here).

    - After each operation, si is incremented (move toward the right) and ei is decremented (move toward the left).

**3. Return the Result:**
- After the loop completes, the accumulated value of ans is returned, which represents the sum of concatenated values from the array.

# Approach
<!-- Describe your approach to solving the problem. -->
**1. Initialization:**
- ans: A variable of type long is used to store the result, which is the sum of concatenated values.
- si: A pointer to the start of the array (initialized to 0).
- ei: A pointer to the end of the array (initialized to nums.length - 1).

**2. While Loop:**
- The while loop runs as long as si <= ei:
    - Concatenation & Summation:
        - If si is not equal to ei, the elements at si and ei are concatenated as strings. The string concatenation is achieved by converting each element to a string using Integer.toString(nums[si]) and Integer.toString(nums[ei]), and then adding them together. The resulting string is then parsed back to an integer, which is added to the result (ans).
        - If si equals ei, it means we are at the middle element (in case of an odd-length array). In this case, we simply add the value of nums[ei] to ans (as no concatenation happens here).

    - After each operation, si is incremented (move toward the right) and ei is decremented (move toward the left).

**3. Return the Result:**
- After the loop completes, the accumulated value of ans is returned, which represents the sum of concatenated values from the array.

# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public long findTheArrayConcVal(int[] nums) {
        long ans = 0;
        int si = 0;
        int ei = nums.length - 1;
        while (si <= ei) {
            if (si != ei) {
                int temp = Integer.parseInt(Integer.toString(nums[si]) + Integer.toString(nums[ei]));
                ans += temp;
            } else {
                ans += nums[ei];
            }
            si++;
            ei--;
        }
        return ans;
    }
}
```
['Array', 'Two Pointers', 'Simulation', 'Java']