Parallel threading in Java
<p>Ok, so I'm trying to find the maximum element of a 2D array.  I will have a method that accepts the 2darray as a parameter and finds the maximum.  It needs to find the maximum element of each row as a separate thread so that the threads run parrallel, then join each thread, and finding the max of those to get the maximum of the entire 2d array.  Now the problem I'm having is that run() does not return any value...How then am i supposed to access the value that has been modified.  for example</p>

<pre><code>public static int maxof2darray(long[][] input){


ArrayList&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;();
long[]rowArray;
for(int i=0; i&lt;input.length; i++){
rowArray = input[i];
teste r1 = new teste(rowArray,max);
threads.add(new Thread(r1));
}

for ( Thread x : threads )
    {
        x.start();

    }
try {


for ( Thread x : threads)
{
      x.join();
}
}
</code></pre>

<p>as you can see it creates an arraylist of thread objects.  Then takes each row and calls the run() function that finds the maximum of that row...the problem is run() does not return any value...How then can i possibly access the maximum of that row? </p>
