I'm new to Java and I'm sure this is very simple. I've been trying to convert a string to byte[]
can't seem to do it. I'm using it for a printer.
ArrayList<byte[]> commands = new ArrayList<byte[]>();
commands.add(new byte[] { 0x1b, 0x2d, 0x00 });
The above works fine but what i need is to be able to take the 0x1b
, 0x2d
, 0x00
value and insert it from a string like
String hexcode = "0x1b, 0x2d, 0x00";
commands.add(new byte[] { hexcode });
I've tried a ton of stuff can't seem to get it to go.