Tryam Tryam - 6 months ago 64
Java Question

Printing byte array in android logcat

I want to debug my android app and I need to print 2d byte array in

. How can I do it?

I have such code:

byte[][] commandsArray = new byte[5][5];
//Filling in the array
Log.i("TEST", Arrays.toString(commandsArray));

It prints something like:
I/TEST: [[B@25527680, [B@2b37a4b9, [B@3af7b0fe, [B@35d7f05f]...


You can always use double for loop like this:

for(int x = 0; x < commandsArray.length; x++)
    for(int y = 0; y < commandsArray[x].length; y++)
        Log.i("TEST", ""+commandsArray[x][y]);