I have String:
String str = "KITTEN"; And I would like to make a byte[] from it, but just:
byte[] mybyte = new byte[] { 'K', 'I', 'T', 'T', 'E', 'N'} Anyone knows how to change String to that byte[]? Everything what I can find is about actual converting - please note that I don't want to have hex representation of string.
PS. Title of question may be wrong - I'm sorry for that, didn't know how to write it.
EDIT:
byte[] myBytes = str.getBytes(); Displaying:
byte[] display = new byte[] { 0x00, 0, 0, 'K', 'I', 'T'}; works, and displaying:
byte[] display = new byte[] { 0x00, 0, 0, myBytes[0], myBytes[1], myBytes[2] }; doesn't work. I try to display it on the screen of my device connected to the android phone by NFC. Do you know what's make the problem?
String.getBytes()"KITTEN"and not something containing some Unicode control characters.) How they're displayed in the debugger is a different matter.getBytes()works fine - it's either your diagnostics or what you're trying to do that's wrong. Unfortunately you still haven't really given us enough context.getMessage()result from the exception you'll get some detailed cause info.)