简体   繁体   English

android-如何在java中将字符串转换为相同的byte []值

[英]android - How to convert String to same byte[] value in java

My input is "[B@ec3c95b" 我的输入是“ [B @ ec3c95b”

String example ="[B@ec3c95b"; 字符串示例=“ [B @ ec3c95b”;

I want to make it same as output "[B@ec3c95b" in byte array type. 我想使其与字节数组类型的输出“ [B @ ec3c95b””相同。

If I understand, you want to convert a String in a byte array. 据我了解,您想将一个String转换为字节数组。

For that, you can use the getBytes() function to convert your String : 为此,可以使用getBytes()函数转换String:

String input = "[B@ec3c95b";
byte[] output = input.getBytes();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM