fork(1) download
  1. class Ideone {
  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++) {
  6. firstArray[i] =(int)Math.round(Math.random() * 50);
  7. }
  8. for (int i = firstArray.length - 1; i >= 0; i--) {
  9. secondArray[secondArray.length - i - 1] = firstArray[i];
  10. }
  11. System.out.println("\nPrimeiro Array:");
  12. for (int i = 0; i < firstArray.length; i++) {
  13. System.out.print(firstArray[i] + "; ");
  14. }
  15. System.out.println("\nSegundo Array:");
  16. for (int i = 0; i < secondArray.length; i++) {
  17. System.out.print(secondArray[i] + "; ");
  18. }
  19. }
  20. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
Primeiro Array:
40; 10; 2; 38; 18; 11; 40; 22; 9; 11; 
Segundo Array:
11; 9; 22; 40; 11; 18; 38; 2; 10; 40;