Ordering methods in java
<p>So this is the case: I want my java output to show me the the reverse order in a certain array, the sum of the numbers in that same array, and the largest number. However when I first tried out my code, in which I inserted the values 1,2,3,4,5,6,7,8,9,10:</p>

<pre><code>import java.util.*;
public class AssignSeven {
  public static void main(String[] args) {
    int [] array1=new int[10];
    System.out.println("Enter 10 numbers");
    Scanner sc=new Scanner(System.in);
    for (int i=0;
         i &lt; 10;
         i++) {
      int a=sc.nextInt();
      array1[i]=a;
    }
    sc.close();
    printReverse(array1);
    computeTotal(array1);
    getLargest(array1);
  }
  static void printReverse(int[] array1) {
    for (int i=0;
         i &lt; array1.length / 2;
         i++) {
      int temp=array1[i];
      array1[i]=array1[array1.length - 1 - i];
      array1[array1.length - 1 - i]=temp;
    }
    System.out.println("The numbers in reverse order is: " + Arrays.toString(array1));
  }
  static void computeTotal(int[] array1) {
    int total=0;
    for (int j=0;
         j &lt; array1.length;
         j++) {
      total=total + array1[j];
    }
    System.out.println("The sum of these numbers is: " + total);
  }
  static void getLargest(int[] array1) {
    int c;
    int d=0;
    for (c=0;
         c &lt; 9;
         c++) {
      if (array1[c] &lt; array1[c+1]) {
        d=array1[c+1];
      }
      else {
        d=array1[c];
      }
    }
    System.out.println("The highest value is: " + d);
  }
}
</code></pre>

<p>The results show as:</p>

<pre><code>The numbers in reverse order is: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

The sum of these numbers is: 55

The highest value is: 2
</code></pre>

<p>Of course, the last portion is wrong, whereas it should be 10 instead of 2. However, when I set the method call in this order</p>

<pre><code>computeTotal(array1);
getLargest(array1);
printReverse(array1);
</code></pre>

<p>The results show the right answer. However, I want the <code>printReverse</code> method to come first. Is there any way to handle this? Thank you!</p>