Android Studio debugger copy value of array

Lazaros Papadopoulos :

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

Sam :

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 :)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=431915&siteId=1