aar6947

Untitled

Sep 15th, 2020
931
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import java.lang.*;
  3. import java.util.*;
  4.  
  5. class Main {
  6.   public static void main(String []args){
  7.     int arrayElements[] = {0,1,2,3,4,5,6};
  8.     int arrayLength = arrayElements.length;
  9.     int result[] = new int[arrayLength];
  10.    
  11.     System.out.println(Arrays.toString(result));
  12.  
  13.     for (int counter = arrayLength -1; counter >= 0; counter--) {
  14.      
  15.       result[arrayLength - 1 - counter] = arrayElements[counter];
  16.     }
  17.    
  18.     System.out.println(Arrays.toString(result));
  19.   }
  20. }
RAW Paste Data