Sending 250 bytes length data with an apdu command

Hi,

I'm trying to send an apdu command with data field length bigger than 128 bytes. I'm using the following code to put the data field length in the apdu command.

apduCommand[OFFSET_LC] = Byte.parseByte(Integer.toHexString(p.length),16);

Using this I got a number format exception. Have you an idea ?

Regards

[342 byte] By [Darwiina] at [2007-11-27 11:23:34]
# 1

Use simple casting instead:

apduCommand[OFFSET_LC] = (byte) p.length;

Lillesanda at 2007-7-29 15:01:27 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2

> Use simple casting instead:

> apduCommand[OFFSET_LC] = (byte) p.length;

Hi,

Thanks for your answer. I've tried the simple casting but steels the Java.lang.NumberFormatException.

Message was edited by:

Darwiin

Darwiina at 2007-7-29 15:01:27 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 3

Strange, it worked for me when I tried

System.out.println((byte) 250);

I'm pretty sure you're doing something else wrong, as NumberFormatExceptions are thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format."

Lillesanda at 2007-7-29 15:01:27 > top of Java-index,Java Mobility Forums,Consumer and Commerce...