Search for a command to run...
Given a list of integers, the task is to use Java Streams to process the list in the following sequence:
If the input array is empty or contains no even numbers, the result must be $0.0$. The final output should be formatted to 4 decimal places.
Input: $[1, 2, 3, 4, 5, 6]$
Output: $18.6667$
> Calculation: Even numbers $\rightarrow [2, 4, 6]$. Squares $\rightarrow [4, 16, 36]$. Average $= (4 + 16 + 36) / 3 \approx 18.6667$.
Example 1
[1,2,3,4,5,6]18.6667[1,2,3,4,5,6]
18.6667