title: How to return elements of Array in reverse order
body: <p>i need to write a method. which will accept any array as input and return another array as output . out put array elements should be in reverse order</p>
  
  <pre><code>input a[]={123};
  output b[]={321};
  </code></pre>
  
  <p><strong>note:</strong> as a array and get another array which includes the same elements but in reverse order
  <strong>What I tried</strong></p>
  
  <pre><code>public class p112409 
  {
     public static int nums[] = { 5, 11, 9 }; 
     public static void main(String[] args) { 
       p112409.reverse3(nums); 
  } 
  
  public static int[] reverse3(int[] nums) 
  { 
      int rev[] = { 0, 0, 0, 0 }; 
      int lenght = nums.length; 
      for (int i = lenght - 1; i &gt;= 0; i--) 
      {
        rev[i] = nums[i]; System.out.println(rev[i]); 
      }
      return nums; 
    } 
  } 
  </code></pre>
  
  <p>lang: Java only</p>