convert string to bytes kotlin code example Example: kotlin string to bytes "my string".toByteArray()