code: private static int[] intListToPrimitiveArray(List<Integer> result)
      {
          int[] resultArray = new int[result.size()];
          int index = 0;
  
          for (int r : result)
          {
              resultArray[index] = result.get(index);
              index++;
          }
  
          return resultArray;
      }
docs: The #toArray methods of collections cannot be used with primitive arrays. This loops over and array list of
  Integers and outputs and array of int.
  
  @param  result The array of Integers to convert.
  
  @return An array of int.