java
の文字列をバイト配列に変換する場合、Javaのバイト配列を操作する場合、ストリングをバイト配列に変換する必要があります。この変換を実現するために使用できるいくつかの方法があります。例:
string str = "hello world"; byte [] bytes = str.getBytes();
String str = "Hello World"; byte[] bytes = str.getBytes();
byte [] bytes = str.getBytes(stardingcharsets.utf_8);
byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
System.out.println(arrays.tostring(bytes));
System.out.println(Arrays.toString(bytes));
文字列str = new String(bytes);
String str = new String(bytes);
免責事項: 提供されるすべてのリソースの一部はインターネットからのものです。お客様の著作権またはその他の権利および利益の侵害がある場合は、詳細な理由を説明し、著作権または権利および利益の証拠を提出して、電子メール [email protected] に送信してください。 できるだけ早く対応させていただきます。
Copyright© 2022 湘ICP备2022001581号-3