title: Storing a sorted array in Java?
body: <p>I would like to store the array which I sorted in the last line of code into a new array so that I will be able to use it later on. </p>
  
  <p>I started with generating a an array with 10 random numbers, ranging from 1 to 100 and I used the Arrays class in Java to sort that array in ascending order. I want to store a new array with the numbers that are in ascending order. Is there a way to do this?</p>
  
  <pre><code>public static void main(String args[])
  {
      /*
       * Generate a random array of 10 numbers using numbers 1-100
       */
  
      int[] array = new int[10];       
  
      System.out.println("Random array:");
      for (int i = 0; i &lt; 10; i++)
      {
          int n = (int)(Math.random()*100 + 1);
          array[i] = n;
          //System.out.println(array[i]);
      }
  
      System.out.println(Arrays.toString(array));
  
      System.out.println("\nAscending Order:");
  
      Arrays.sort(array);      
  
  }
  </code></pre>