String to binary output in Java

前端 未结 3 1308
[愿得一人]
[愿得一人] 2020-12-31 14:05

I want to get binary (011001..) from a String but instead i get [B@addbf1 , there must be an easy transformation to do this but I don\'t see it.

public stati         


        
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-31 14:19

    Arrays do not have a sensible toString override, so they use the default object notation.

    Change your last line to

    return Arrays.toString(infoBin);
    

    and you'll get the expected output.

提交回复
热议问题