-1

I have a method rotateImage that returns an int[][] array, I am having trouble understaing how to display the actual values of the array instead of just the hashcode:

[I@548c4f57
[I@1218025c
[I@816f27d

I tried doing this:

Arrays.stream(rotateImage(matrix)).forEach(System.out::println);

but that only returns the hashcode, not the actual numbers themselves. I also tried using to Arrays.toString() method in several ways but always get an error.

Andreas
  • 154,647
  • 11
  • 152
  • 247

1 Answers1

0

It's cause you're accessing the address and not the actual values. You can simply do a lambda function and iterate through each row

Arrays.stream(rotateImage(matrix)).
         forEach(row -> {
             for(int i : row) {
                System.out.println(i);                 
             }
        });
Simon He
  • 96
  • 5