PJF16

Reverse

Dec 9th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public class TestArrayRekursion {
  2.    
  3.     public static void printArray (int [][] array) {
  4.         for (int i=0; i<array.length; i++) {
  5.             for (int j=0; j<Array.getLength(array[i]);j++){
  6.                 System.out.println("["+i+"] ["+array[i][j]+"]");
  7.             }
  8.         }
  9.     }
  10.    
  11.     public static void main (String [] args) {
  12.         int array [][] = new int [][] { {1,2,3}, {5,6,4},{3,4,3,212,2} };
  13.         printArray (array);
  14.         test (array);
  15.     }
  16.    
  17.    public static void test (int [][] array) {
  18.        Collections.reverse(Arrays.asList(array));
  19.        printArray(array);
  20.    }
  21.    
  22. }
Advertisement
Add Comment
Please, Sign In to add comment