Java Array Stream Reduce Example Python Loop