title: Is there a way to somehow extract an int[ ] array value from a method that returns a void?
body: <p>If I have the following code that modifies a created array and returns only a <strong>void</strong>:</p>
  
  <pre><code> public static void modifyArray()
  {
        myFunction(createArray(1));
  }
  </code></pre>
  
  <p>Where  <code>createArray()</code> is just some function that generates an array as follows:</p>
  
  <pre><code> public static int[] createArray(int n)
   {
        //Lines of code that generate an array;
   }
  </code></pre>
  
  <p>And <code>myFunction()</code> is just some arbitrary function that modifies an array and returns it as a void:</p>
  
  <pre><code> public static void myFunction(int[] anArray)
   {
        //Lines of codes that modifies any int[] array passed to this function;
   }
  </code></pre>
  
  <p>How can I get back the modified array in the <code>modifyArray()</code> function as an <strong>int[ ]</strong> using another function, WITHOUT changing the return type of <code>myFunction()</code> to an int[], such as:</p>
  
  <pre><code>    public static int[] convertModifiedArray()
      {
             return modifyArray(); //This is an error since modifyArray() is a void, not an int[].  I just don't know a way to somehow "translate" a void into an int[] and I need help with this part.
      }
  </code></pre>