Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio debugger copy value of array

I have a Base64-encoded key, as an input String, from which I want to create a new byte array using the decode method. I want to copy the resulting bytes to my notepad. I put a breakpoint and I execute the code in the debugger and everything work as they should. The array size is 392. I want to copy to the clipboard the value of the inputbytes array, so I right click on the bytes array, select "Copy Value" and then I paste it on a Notepad, but nothing is pasted. It seems that the value of the array cannot be copied. What am I doing wrong? How can I copy the value of the array?

String input ="Ajw9DS8nJCMtFRI0GhkGCEwDfyQMNCgpMzgKMTM+dzQ5Bi8PJgokMTgUNzMWJz46DTEZEhUMNlY3CkYqGDQeJjYVaSwPE8jIwA9BhYGBhI5ND84Q0wTJxUWNyI/NTMUCBktHAAxGQAYJBADKQNiHyEdNisMPB8dKBM1BgoCVx4ZNiATk34aIgIWfwpiNgAKPBgsPQY2GCMAfDZ8VCAnCx4AFwE4JB0mCxUoMyssMFIJCBkrLhYgOSwnAVQAIU8sOiYjAgxFI1A3FUIqASgOWUIuCBoifCcMAAA5Rk01J0INFw8sdlMsAFtWCjx2PztAeidBHz85LB4EOBcUARc6BwY2IjUOLhg1GhJwHiFeYEwlDk07MwooHRYWXSEFGBMQLScLH15dGygXMyEKeS9NFykgh5RE0sMSApFhEgfzUgDgQeJUgWQQc4ewAiJAU4UgYtIxF1GyEieUM2Lh81CSYOPAMPCDQCfTIRASUCAQUtITgdAB4MFTlDBB91KVwjXQ4MNjF+Djc=";
byte[] inputbytes = Base64.decode(input, Base64.DEFAULT);  

enter image description here

Android Studio 2.3.3

like image 655
Lazaros Papadopoulos Avatar asked Aug 27 '17 09:08

Lazaros Papadopoulos


1 Answers

Seems, that you cannot just copy arrays. Only single values.

While at the breakpoint, press Alt + F8. That opens Evaluate expression pop-up. Enter there the following code:

Arrays.toString(inputBytes)

That will give the output of string formatted like the following:

[97, 115, 100]

enter image description here

From there you can manipulate with .replace* methods of the String class to remove the commas and the brackets. Or just use your text-editor.

Good luck :)

like image 189
Sam Avatar answered Sep 22 '22 13:09

Sam