I want to read block wise data of NFC tag. For which the command is a byte array and it needs block number.
public static byte[] readSingleBlockCmd(int blockNo) {
byte[] cmd = new byte[3];
cmd[0] = (byte) 0x02;//flag
cmd[1] = (byte) 0x23;//cmd
cmd[2]= (byte)blockNo;
return cmd;
}
- How can I change the int blockNo to its hexadecimal value , which can be cast to byte .I want the byte value and not an byte []
I have gone through the following links
Convert integer into byte array (Java)
How to autoconvert hexcode to use it as byte[] in Java?
Thanks!