I have the following code:
byte[] someArray;
int a,b;
.
.
.
a=123; (result coming from calculations, always 0>=a<256)
b=91; (result coming from calculations, always 0>=b<256)
now i want to do this
someArray[0]=a;
someArray[6]=b;
however i tried to convert in to byte to this i failed (getting all the possible error messages i think). also tried various snippets referring to integer to byte conversion.
so any idea?
update this is what i get java.lang.NumberFormatException: Invalid int: "z" when i try this byteArray[0]=Integer.valueOf(String.valueOf(bani.substring(2, 3)), 16).byteValue();
someArray[0] = (byte) a?