### Returning Multiple Values in Java - Javatpoint

###### Complexity Analysis: Since the program is using a for-loop for computing the sum of elements, the time complexity of the program is O(n), where n is the total number of elements present in the array. The space complexity of the program is constant, i.e., O(1). Case 2: If we have to return two values of different types. In case we have the two values of the different types, we can use Pair.