A byte is the basic unit of 1-byte, 8-bit data.
Byte sequence byte []: Fixed-length byte string // Data cannot be changed once decided. Column = array saw ByteArrayOutputStream: Variable length byte string // Data can be changed / added later
Conversion from byte array to String byte [] bytes = new byte [] {0x61, 0x62, 0x63} / 0x61 is a hexadecimal number String s = new String(bytes); // => abc
Conversion from String to byte array String s = abc; byte [] bytes = s.getBytes (); // Receive as byte data.
Conversion from String to UTF-8 byte string String s = Aiueo; byte[] bytes = s,getBytes(java.nio.charset.StandardCharsets.UTF_8);
Recommended Posts