slippy wrote:I thought that bytes could only hold numbers ?
I need to hold hexadecimal
Yes bytes only hold numbers, but no it'll work because you if mark how long each byte array is and use that to know how much data to put into the array, you can send as much text as you want via byte arrays. Basically, it is what pascal does for utf8 I believe instead of using a null terminating character that is in c I think.
hexadecimal --> string --> byte[]
- Code: Select all
getBytes
public byte[] getBytes(String charset)
Get bytes in US Acsii
Parameters:
charset - ignored
Returns:
the ascii bytes
byte[] --->string -->hexadecimal
- Code: Select all
public String(byte[] b)
Create a String from a byte array
Parameters:
b - the byte array
Note I'm leaving hexadecimal conversion to you but from a string that is no problem I suspect