Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在从页面中读取一个字节数组作为字符串。示例:"80 75 7 8 0 0"。我想将此字符串转换为 Java 中的字节数组。谁能帮助我/告诉我我可以使用什么方法?
"80 75 7 8 0 0"
谢谢你。
尝试:
String[] bytesString = originalString.split(" "); byte[] bytes = new byte[bytesString.length]; for(int i = 0 ; i < bytes.length ; ++i) { bytes[i] = Byte.parseByte(bytesString[i]); }