input: Write a function to find the maximum sum of a non-negative integer array under a given upper limit. If it is possible to achieve a sum that does not exceed the limit, return that sum, otherwise return 0. If the array is empty or the limit is negative, return 0.
  assert findMaxSum(10, [1, 3, 5, 4, 2, 6])==10
  assert findMaxSum(8, [1, 3, 5, 4, 2, 6])==8
  assert findMaxSum(15, [1, 3, 5, 4, 2, 6])==21
  assert findMaxSum(5, [1, 3, 5, 4, 2, 6])==5
  assert findMaxSum(0, [1, 3, 5, 4, 2, 6])==0
  assert findMaxSum(-1, [1, 3, 5, 4, 2, 6])==0
  assert findMaxSum(10, [])==0
output: def findMaxSum(limit, arr):
      if limit < 0 or not arr:
          return 0
      arr.sort(reverse=True)
      current_sum = 0
      for num in arr:
          if current_sum + num <= limit:
              current_sum += num
          else:
              break
      return current_sum