fork download
  1. class Main {
  2. public static void main (String[] args) {
  3. int[] firstArray = new int[10];
  4. int[] secondArray = new int[10];
  5. for (int i = 0; i < firstArray.length; i++) firstArray[i] =(int)Math.round(Math.random() * 50);
  6. for (int i = firstArray.length - 1; i >= 0; i--) secondArray[secondArray.length - i - 1] = firstArray[i];
  7. System.out.println("\nPrimeiro Array:");
  8. for (int i = 0; i < firstArray.length; i++) System.out.print(firstArray[i] + "; ");
  9. System.out.println("\nSegundo Array:");
  10. for (int i = 0; i < secondArray.length; i++) System.out.print(secondArray[i] + "; ");
  11. }
  12. }
  13.  
  14. //https://pt.stackoverflow.com/q/130712/101
Success #stdin #stdout 0.09s 33840KB
stdin
Standard input is empty
stdout
Primeiro Array:
23; 19; 27; 10; 18; 7; 21; 5; 36; 38; 
Segundo Array:
38; 36; 5; 21; 7; 18; 10; 27; 19; 23;